The 's' replaces just one House match at any given time though the 's+' replaces The complete House sequence at once with the 2nd parameter.Nonetheless x.replaceAll("s+", ""); is going to be extra efficient way of trimming Areas (if string may have a number of contiguous spaces) since of potentially significantly less no of replacements because of