Board index » jbuilder » String.indexOf issues with : character
String.indexOf issues with : character
2003-11-01 08:03:35 AM
I am using JBuilder 4 (I know, it is old) and java -version returns the
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)
I have an issue when searching for a substring using the indexOf method of
the String class, when the : character exists.
For example - I have a very long string that in it has the substring
When I search for FirstDateStr or FirstDateStr]
(Source.indexOf("FirstDateStr]") - I get the value 424
When I search for :FirstDateStr or :FirstDateStr]
(Source.indexOf(":FirstDateStr]") - I get the value -1
Here is the crazy stuff -
When I search for [FirstDateStr] (Source.indexOf("[FirstDateStr]") I get 423
It seems as if the : is ignored in the source string, but not in the
substring I am searching for.
Any ideas what I am doing wrong?