Marc's suggestion will work, but you don't even need a Java action for it. There is also a replaceAll
function available in microflow expressions with a very similar syntax:
replaceAll($myString, '\s+', ' ')
Within the a microflow can't you change the attribute with :
replaceAll($Entity/attribute, ' ',' ')
within the first '' there would be three spaces and within the next would be two.
this is of course if you know that you want three spaces to be reduced to two.
i don't think that will work in this case, as there can be possibilties when there could be four blank spaces in a row
Probably need java then, unfortunately I'm not a lot of help there. Probably contains a statement like:
text = text.replaceAll("\s+", " ");
Do you think this will work: StringBuilder builder = new StringBuilder(word); for(int i = 0; i < builder.length(); i++) { if (Character.isWhitespace(builder.charAt(i)) && Character.isWhitespace(builder.charAt(i + 1))) { builder.deleteCharAt(i); word = builder.toString(); excessSpace(); }
}