Q: Java String split with   as pameter I read a html file parser. Jsoup.parse(new File("2005-08.html"),   "ISO-8859-1"); and then I need to split a string like "+24 -2" into two: "+24" and "-2". Then I pass this string to System.out.println() it prints as whitespase. I tried
s.split(" ");
s.split(" ");

but nothing works. I get one string "+24 -2". 

A: You say your input is +24 -2 and you want to split it into +24 and -2.
Well that is pretty easy and it uses the same technique than your tried with:
String s = "+24 -2";

// The correct delimiter begins with an '&'
String[] result = s.split(" ");

// Print the result
System.out.println(Arrays.toString(result));

The output is [+24, -2]. You can access the results by result[0] which yields +24 and result[1] which is -2.

If you like you can also parse them as Integer by using:
int firstValue = Integer.parseInt(result[0]);
int secondValue = Integer.parseInt(result[1]);

