RPASOFT
(RPASOFT)
April 13, 2021, 11:49am
1
good morning, I would like to remove multiple blanks from a string, currently I use assign srtPDF.Replace (" ", “”)
I want to leave the whole string with a single white space separations, since in the string there are up to 3 white spaces and sometimes 2, this that I put, sometimes works for me … some alternative
prasath_S
(prasath S)
April 13, 2021, 11:52am
2
Hi @RPASOFT
Use this regex pattern in matches activity
[^\s]+
RPASOFT
(RPASOFT)
April 13, 2021, 11:56am
3
I can’t understand your solution, if I have a string with 2 spaces, how do I leave it in a single space?
@RPASOFT
You can just add one more extra space in the replace
varStr.Replace(" ","").ToString
1 Like
prasath_S
(prasath S)
April 13, 2021, 12:08pm
5
After macthes in assign write this syntax
strText - string, mtchColl - Matches output variable
strText = string.join(" ",mtchColl.Cast(of match).Select(function(d) d.ToString).toarray)
matches Input String
Output String in message box
Please mark it as solution if it hepls. Thanks
Adrian_Star
(Adrian Starukiewicz)
April 13, 2021, 12:12pm
6
Hi,
Replacing 2 or more whitespace:
output = System.Text.RegularExpressions.Regex.Replace(your_String, "\s{2,}" , " ")
output = String
your_String= String
Preview link: regex101: build, test, and debug regex
system
(system)
Closed
April 16, 2021, 12:12pm
7
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.