Quantcast
Channel: Extract an int from a large string - Stack Overflow
Viewing all articles
Browse latest Browse all 6

Extract an int from a large string

$
0
0

I'm trying to get an int from a String. The String will always come as:

"mombojumbomombojumbomombojumbomombojumbomombojumbomombojumbohello=1?fdjaslkd;fdsjaflkdjfdklsa;fjdklsa;djsfklsa;dfjklds;afj=124214fdsamf=352"

The only constant in all of this, is that I will have a "hello=" followed by a number. With just that, I can't figure out how to pull out the number after the "hello=". This is what I have tried so far with no luck.

EDIT: The number will always be followed by a "?"

String[] tokens = s.split("hello=");for (String t : tokens)    System.out.println(t);

I can't figure out how to isolate it from both sides of the int.


Viewing all articles
Browse latest Browse all 6

Latest Images

Trending Articles





Latest Images