The 's' replaces just one House match at any given time although the 's+' replaces The full space sequence at the same time with the 2nd parameter.Even so x.replaceAll("s+", ""); are going to be more efficient way of trimming Areas (if string may have many contiguous spaces) since of probably significantly less no of replacements because of the to