remove all spaces in array java code example
Example 1: how to remove spaces from an array in java
for (int i = 0; i < temp.length; i++){
temp[i] = if(!temp[i].trim().equals("") || temp[i]!=null)temp[i].trim();
}
Example 2: java array remove space
String str = "Programming is easy to learn";
String result = str.replaceAll("\\s+","");