how to get all string without space code example Example: remove space string java a = a.replaceAll("\\s+", "");