java string split and remove space code example
Example 1: remove space string java
a = a.replaceAll("\\s+", "");
Example 2: how to strip spaces in java using split with other delimiters
String[] splitted = input. trim(). split("\\s*,\\s*");
a = a.replaceAll("\\s+", "");
String[] splitted = input. trim(). split("\\s*,\\s*");