Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #24928 > unrolled thread
| Started by | smarty.ad4@gmail.com |
|---|---|
| First post | 2013-08-08 05:06 -0700 |
| Last post | 2013-08-09 08:47 -0400 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.lang.java.programmer
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: java String split() does not work for delimiter "|" ? smarty.ad4@gmail.com - 2013-08-08 05:06 -0700
Re: java String split() does not work for delimiter "|" ? Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-08-09 08:47 -0400
| From | smarty.ad4@gmail.com |
|---|---|
| Date | 2013-08-08 05:06 -0700 |
| Subject | Re: java String split() does not work for delimiter "|" ? |
| Message-ID | <b4fb2990-e9b4-45ed-a887-e63c1994d8d5@googlegroups.com> |
On Saturday, 13 October 2007 02:09:06 UTC+5:30, chun...@gmail.com wrote:
> Hi all,
>
> I have such data in a flat text file,
> "
> 106083|1791||7|73755|48|96|3||01/07/2005 13:04:48.979215 PST|||||t|f||
> t|f|t|"
> "
>
> And such java code to read this line and split it by "|",
>
> "
> while ((( rd = in.readLine())!= null)) {
> String delimiter = new String(''|")
> String[] t1 = rd.split(delimiter);
> String[] t2 = rd.split("|");
> }
> "
>
> Either way, the split does not work! It splits the string per each
> char. Does someone know why ?
>
> Here is my jdk information on the linux box.
> "
> java version "1.6.0"
> Java(TM) SE Runtime Environment (build 1.6.0-b105)
> Java HotSpot(TM) Server VM (build 1.6.0-b105, mixed mode)
> "
>
>
> Thanks a lot for any tips.
>
>
> Chun
You can also do like this :
StringTokenizer tokenizer = new StringTokenizer(content, "||");
while(tokenizer.hasMoreTokens()){
_log.info("tokenizer.nextToken() : "+tokenizer.nextToken());
}
[toc] | [next] | [standalone]
| From | Eric Sosman <esosman@comcast-dot-net.invalid> |
|---|---|
| Date | 2013-08-09 08:47 -0400 |
| Message-ID | <ku2od1$tff$1@dont-email.me> |
| In reply to | #24928 |
On 8/8/2013 8:06 AM, smarty.ad4@gmail.com wrote:
> On Saturday, 13 October 2007 02:09:06 UTC+5:30, chun...@gmail.com wrote:
Couldn't you have waited for its sixth birthday?
--
Eric Sosman
esosman@comcast-dot-net.invalid
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.java.programmer
csiph-web