extraction of text in jsp

hello, i was wandering hw cld you extract text from the below string...

using a form i recieve a string as a parameter the format as:

"some text , some text, some text "

i want to extract the text after the second comma...

i can get the first two text bu using split at the the comma but how do

i get the third?

thanks,

moh

[373 byte] By [moh_1_and_onlya] at [2007-11-26 19:27:21]
# 1
String inputStr = "some text , some text, some text ";String[ ] splitStr = inputStr.split(",");out.println(splitStr[2]);
radtad82a at 2007-7-9 21:53:38 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
hello that helped me a lot but lets say if also sometimes there isa input string that is not seperated by commas and is just one stringwhat can i do to pass that string as a parameterthanks,
moh_1_and_onlya at 2007-7-9 21:53:38 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
you could use a stringtokenizer....
reecha05a at 2007-7-9 21:53:38 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
cld anyone plz give me an example or code of hw to do it plzMessage was edited by: moh_1_and_only
moh_1_and_onlya at 2007-7-9 21:53:39 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5
this should be post in the "new to java" forum
alban.maillerea at 2007-7-9 21:53:39 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 6

well, what is the seperator in the text. For string tokenizer or anything a seperator is required like comma(,).hash(#),pipe(|) like this. If the string doesn't contain any such thing then you need to seperate the string as per your requirement first and then use string tokenizer.

String s="you|are|so|good|like|this";

string is se

StringTokenizer st = new StringTokenizer(s,"|");

While st.hasMoreTokens()

{

System.out.println(st.nextToken());

}

good luck.

cvasu4a at 2007-7-9 21:53:39 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...