🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.jbuilder.java.api
4 messages
4 total messages Started by Ron Loewy Sat, 01 Nov 2003 00:03
String.indexOf issues with : character
#394
Author: Ron Loewy
Date: Sat, 01 Nov 2003 00:03
29 lines
1837 bytes
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.
Re: String.indexOf issues with : character
#395
Author: Kevin Dean
Date: Sun, 02 Nov 2003 18:51
49 lines
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.
>
>
>
>
Re: String.indexOf issues with : character
#396
Author: Ron Loewy
Date: Mon, 03 Nov 2003 18:12
15 lines
1500 bytes
"Kevin Dean" <NkOdSePaAnM@datadevelopment.com> wrote in message
news:3fa55492$1@newsgroups.borland.com...
> 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.
>

Thanks. Actually the source string did include the string - but I was
transposing a couple of characters in the search string and somehow managed
not to see it for more than an hour...

Too much work, not enough play, I guess. Sorry for the false alarm.

Ron.
Re: String.indexOf issues with : character
#400
Author: Kevin Dean
Date: Mon, 03 Nov 2003 22:44
33 lines
2000 bytes
No problem.  Been there, done that.

-- 
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:3fa69a7e$1@newsgroups.borland.com...
>
> "Kevin Dean" <NkOdSePaAnM@datadevelopment.com> wrote in message
> news:3fa55492$1@newsgroups.borland.com...
> > 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.
> >
>
> Thanks. Actually the source string did include the string - but I was
> transposing a couple of characters in the search string and somehow
managed
> not to see it for more than an hour...
>
> Too much work, not enough play, I guess. Sorry for the false alarm.
>
> Ron.
>
>
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads