The 's' replaces just one Room match at a time though the 's+' replaces The full space sequence without delay with the second parameter. On the other hand x.replaceAll("\s+", ""); might be a lot more effective technique for trimming spaces (if string might have many contiguous spaces) for the reason https://elliotnqmdu.activosblog.com/30611965/how-much-you-need-to-expect-you-ll-pay-for-a-good-mantra-mushroom-chocolate-bars