Article View: borland.public.jbuilder.java.api
Article #395Re: String.indexOf issues with : character
From: Kevin Dean
Date: Sun, 02 Nov 2003 18:51
Date: Sun, 02 Nov 2003 18:51
49 lines
2508 bytes
2508 bytes
I've never seen indexOf behave like that. What you're seeing suggests to me
that the source string doesn't contain the data you think it does.
--
Check out our latest white papers at
http://www.datadevelopment.com/papers/index.html
BladeNET Scores With Borland Enterprise Tools
Team Development with JBuilder and Borland Enterprise Server
Dolphin Data Development Ltd.
http://www.datadevelopment.com/
"Ron Loewy" <nospam@spam.com> wrote in message
news:3fa2f859$1@newsgroups.borland.com...
> Hi,
>
> I am using JBuilder 4 (I know, it is old) and java -version returns the
> following:
>
> 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
> [:FirstDateStr]
>
> 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?
>
> Thanks,
> Ron.
>
>
>
>
Technical Details
Message-ID:
<3fa55492$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<3fa2f859$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1089d0,71d980371de077c8 X-Google-Attributes: gid1089d0,public X-Google-ArrivalTime: 2003-11-02 11:09:17 PST From: "Kevin Dean" <NkOdSePaAnM@datadevelopment.com> Newsgroups: borland.public.jbuilder.java.api References: <3fa2f859$1@newsgroups.borland.com> Subject: Re: String.indexOf issues with : character Date: Sun, 2 Nov 2003 13:51:45 -0500 Lines: 51 Organization: Dolphin Data Development Ltd. X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: 24.57.150.243 Message-ID: <3fa55492$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1067799698 24.57.150.243 (2 Nov 2003 11:01:38 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail