string value

hi i have a string:String s = "Hello?Friends";I need to print whatever the value comes after ? ie "Friends" here.Note, i will be getting string values are dynamic here separating with ?.
[214 byte] By [kasima] at [2007-11-27 9:14:05]
# 1
look at string tokenizer
jenny_07a at 2007-7-12 22:02:01 > top of Java-index,Java Essentials,Java Programming...
# 2
String s = "Hello?Friends";Pattern pattern = Pattern.compile("(?<=\\?)\\w+(?=\\b)");Matcher matcher = pattern.matcher(s);System.out.println(matcher.find() ? matcher.group() : "Nothing
prometheuzza at 2007-7-12 22:02:01 > top of Java-index,Java Essentials,Java Programming...
# 3
> look at string tokenizerString tokenizer will not work here, since it will display all the values, before and after ?. i need only values after ?.
kasima at 2007-7-12 22:02:01 > top of Java-index,Java Essentials,Java Programming...
# 4

> String s = "Hello?Friends";

> Pattern pattern =

> Pattern.compile("(?<=\\?)\\w+(?=\\b)");

>Matcher matcher = pattern.matcher(s);

> System.out.println(matcher.find() ? matcher.group()

> : "Nothing found.");

it looks complicated any easier way of doing it?

kasima at 2007-7-12 22:02:01 > top of Java-index,Java Essentials,Java Programming...
# 5

> > String s = "Hello?Friends";

> > Pattern pattern =

> > Pattern.compile("(?<=\\?)\\w+(?=\\b)");

> >Matcher matcher = pattern.matcher(s);

> > System.out.println(matcher.find() ?

> matcher.group()

> > : "Nothing found.");

>

> it looks complicated any easier way of doing it?

Ignore that! Prometheuzz is just showing off his mad regex skills, because someone told him it was medically proven to make your manhood bigger :-)

georgemca at 2007-7-12 22:02:01 > top of Java-index,Java Essentials,Java Programming...
# 6

> > look at string tokenizer

>

> String tokenizer will not work here, since it will

> display all the values, before and after ?. i need

> only values after ?.

Only if you tell it to. StringTokenizer will be fine here, just don't iterate over it blindly pulling off all the values and using them

georgemca at 2007-7-12 22:02:01 > top of Java-index,Java Essentials,Java Programming...
# 7
String s = "Hello?Friends";String[] split = s.split("\\?");String rest = split.length > 0 ? split[1] : "Nothing found";
dwga at 2007-7-12 22:02:01 > top of Java-index,Java Essentials,Java Programming...
# 8

> ...

> Ignore that! Prometheuzz is just showing off his mad

> regex skills, because someone told him it was

> medically proven to make your manhood bigger :-)

Since I bought Friedl's book, my knowledge of the dark regex-force has grown several inches!

; )

prometheuzza at 2007-7-12 22:02:01 > top of Java-index,Java Essentials,Java Programming...