delete all spaces in java string and return number code example Example: java 8 remove spaces from string a.replaceAll("\\s+","");