Problem with IndexOf

  • Thread starter Richard L Rosenheim
  • Start date
R

Richard L Rosenheim

I'm having a problem with IndexOf on a large string. The string contains an
ASCII file which is about 45K. IndexOf is not finding substrings that I
know are in the string. Yes, I double-checked my typing. I'm also able to
locate the strings using a text editor. One substring is about 38K
characters into the string.

Is there any know issues, limitations, etc. with IndexOf that I may not be
aware of?

I'm working with a VB.Net using Visual Studio .Net 2003.

Richard Rosenheim
 
A

Armin Zingler

Richard L Rosenheim said:
I'm having a problem with IndexOf on a large string. The string
contains an ASCII file which is about 45K. IndexOf is not finding
substrings that I know are in the string. Yes, I double-checked my
typing. I'm also able to locate the strings using a text editor.
One substring is about 38K characters into the string.

Is there any know issues, limitations, etc. with IndexOf that I may
not be aware of?

I'm working with a VB.Net using Visual Studio .Net 2003.

I'd write a loop searching for a smaller substring:

dim i as integer

for i = 1 to substring.length
if FullString.indexof(substring.substring(0, i)) = -1 then
msgbox(i)
exit for
end if
next

This way you can find out at which location the string doesn't match.

Note that indexof is case sensitive.

--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top