I have a string which has multiple spaces I am able to remove multiple spaces but I am not able to remove space between one word
Below I have attached sample
Input string = "CENTR. REGIO 28991090 05.00 145320 W3 D VERVANGT 03.01 145320 W3 "
output string required CENTR.REGIO 28991090 05.00 145320 W3 D VERVANGT 03.01 145320 W3
so If you see the CENTR. REGIO it has space and it is a name so I want to remove the space between these two, I am able to remove spaces between different words but not able to remove between name
Hi @Chirag1991 Please watch the video below to solve your problem.
Thanks but his is I do not needed
See I will have the above string and having ,multiple spaces so I will remove those but I am not able to remove between name and name can be change like now it is “CENTR. REGIO” sometime it can be “Chirag” only so I want to where at one go I remove all the spaces between letters and words all.
In that case use regex (regular expression) to find first instance of space in the string and then remove it.
It was a fun little challenge. Solution was to
- Find the first index where “.” is found.
- Use that index in the substring() method
I am attaching a file which you can use to get the required output using invoke workflow. (Remember to remove the default value, I just used the example string you provided)
StringManipulation.xaml (9.8 KB)
Thanks its worked perfect fine I have one more query in same string this string will have two format below
CENTR. REGIO 37902931 02.00 151420 W7 D VERVANGT 01.00 151420 W7
and second one will look like
CENTR. REGIO 37902931 02.00 151420 W7 D
If you see there are many spaces between D and VERVANGT and further
so what I want I want to split in that wau where I can get to know the index of all this value even if it has no value either its blank or not
If it is space seperated CSV maybe you want to load it to data table as such?
I did not understand the reply. I see only one space after D in the first string.
Could you explain using a screenshot with annotations? or
You could write the raw string using the
code formatter this way we get to see the spaces in the string if any. Always good to show us what is the expected behaviour you are after (expected result) as well