Wierd split bug

Hi. I’m splitting a string into 12 seperate strings via the split commando.
This gives med 12 items containing integers as strings.
But for some odd reason on the 12th item I get a number format exception, even though the string contains a valid integer. (When parsing with Integer.parseInt()

Anyone experienced this?

Nope, fine here.

My guess - your String ends in some kind of white space - a carriage return or a space most likely. A bit of debug should show this:

System.out.println("[" + myLongString + “]”);

Those square brackets should be flush with the numbers on either end. You can see whitespace if there’s a gap or the terminating bracket is on the next line.

Stip whitespace from the ends of the String first, with the trim() method.

Well never experienced something like that. But it seams that you could easily write a simple testcase on this in a few lines. Can you post it so others can try and see where the problem lies?

Ahh yeah. My debugger didn’t show the \n at the end of the string.

It’s one of those problems you find a second after posting about it :slight_smile:

Thank you all

just talking about problems is the best way to uncover the solution! :slight_smile:

Halo 2!!!

it’s graphics are sooo bad (gameboy graphics) and it’s first person mode is somewhat to be desired…and the game physics are pritty lame…

I’d like to get the orginal copy of halo 2 and burn it in a furnace at 100,000,000,000,000,000,000,000,000 degrees!!!

Another person worst game i’ve seen or played is… Halo 2!!!

it’s graphics are pritty bad in that is it all squarey… it’s first person mode is somewhat to be desired… and the game physics are soooo bad!!!

when I push right, the your character (you can’t even see him!) turns right 180 degrees!!

this is what can be expected from microsoft and xbox!!!

while i’m on this subject of the xbox, I may as well comment on it. it is just a try hardic version of a computer! it’s general graphics for all the games on the xbox are quite bad. It’s just a PlayStation 2 wanna be!

Whoops! You appear to have accidentally posted this in the wrong thread.

I can’t think of an appropriate thread for his claims :slight_smile: