Extra Spaces

1
Is there a way to check for extra spaces in txt fields, which are not at the beginning or at the end, but are in the middle of the text field. Such as "Renewal file (approval date 01-November-2006 5 year Renewal)" The extra space is after the e on file, the top entry has 3 spaces after e while the bottom entry has only 2. "Renewal file (approval date 01-November-2006 5 year Renewal)"
asked
5 answers
1

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+', ' ')
answered
0

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.

answered
0

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

answered
0

Probably need java then, unfortunately I'm not a lot of help there. Probably contains a statement like:

text = text.replaceAll("\s+", " ");

answered
0

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(); }

    }
answered