If you want to split it by space try,
val = val.split("\\s")[0];
Here the String is split by whitespace (\n, \r, \t, \f, and " ")
0
solved Java String.split not work [closed]
If you want to split it by space try,
val = val.split("\\s")[0];
Here the String is split by whitespace (\n, \r, \t, \f, and " ")
0
solved Java String.split not work [closed]