The 's' replaces 1 space match at a time however the 's+' replaces The entire Area sequence simultaneously with the second parameter.Nonetheless x.replaceAll("s+", ""); might be more efficient way of trimming Areas (if string might have many contiguous spaces) due to the fact of doubtless considerably less no of replacements because of the to incon