I am looking for a Java regex way of replacing multiple spaces with non-breaking spaces. Two or more whitespaces should be replaced with the same number of non-breaking spaces, but single whitespaces should NOT be replaced. This needs to work for any number of whitespaces. And the first characters could be 1 or more whitespaces.
So if my String starts off like this:
TESTING THIS OUT WITH DIFFERENT CASES
I need the new String to look like this:
TESTING THIS OUT WITH DIFFERENT CASES
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…