Article View: borland.public.jbuilder.java.language
Article #8687Re: Can you use a String as a delimeter in StringTokenizer
From: John McGrath TeamB
Date: Wed, 07 Mar 2001 07:15
Date: Wed, 07 Mar 2001 07:15
26 lines
2052 bytes
2052 bytes
On Tue, 06 Mar 2001 14:36:52 -0500, Paul Furbacher [TeamB] wrote:
> If you can drill down into the StringTokenizer class,
> look at the scanToken() method. You'll notice that it
> decomposes the "str" one character at a time from a
> starting position. It then asks, "is this character in
> the "delimiters" by checking for an indexOf() >= 0.
> So, the approach taken by StringTokenizer to get tokens
> is just about backwards from the way you (and many others)
> think it should be working (i.e., looking for the string
> you give as the delimiters as a substring of the source
> string).
The way I (and the StringTokenizer designer, I presume) think of it is
that StringTokenizer takes a set of delimiter characters as the second
argument to the constructor, and a String is a convenient way to
represent a set of characters.
--
Regards,
John McGrath [TeamB]
---------------------------------------------------
Before sending me e-mail, please read:
http://www.JPMcGrath.net/newsgroups/e-mail.html
Technical Details
Message-ID:
<MPG.150f9ac320bb96e798a024@forums.borland.com>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!hermes.visi.com!news-out.visi.com!europa.netcrusader.net!204.71.34.3!newsfeed.cwix.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!bornews.borland.com!not-for-mailReferences:
<9810gn$fl1@bornews.inprise.com> <MPG.150e8591d5d31fe998a014@forums.borland.com> <982rcl$n9q4@bornews.inprise.com> <3AA53C54.39ED719B@bilbo.bio.purdue.edu>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,22501d0a26c51927 X-Google-Attributes: gidf74b3,public X-Google-ArrivalTime: 2001-03-06 23:18:07 PST Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!hermes.visi.com!news-out.visi.com!europa.netcrusader.net!204.71.34.3!newsfeed.cwix.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!bornews.borland.com!not-for-mail From: John McGrath [TeamB] <ng-b@JPMcGrath.net> Newsgroups: borland.public.jbuilder.java.language Subject: Re: Can you use a String as a delimeter in StringTokenizer Date: Wed, 7 Mar 2001 02:15:44 -0500 Organization: Another Netscape Collabra Server User Lines: 26 Message-ID: <MPG.150f9ac320bb96e798a024@forums.borland.com> References: <9810gn$fl1@bornews.inprise.com> <MPG.150e8591d5d31fe998a014@forums.borland.com> <982rcl$n9q4@bornews.inprise.com> <3AA53C54.39ED719B@bilbo.bio.purdue.edu> NNTP-Posting-Host: dslcv1-60.fast.net X-Newsreader: MicroPlanet Gravity v2.30