let say for example
s1=“LUCILA U UDARBE”
output =“LUCILA U UDARBE”
s2="RAMA D SITA "
output=“RAMA D SITA”
Can anyone help on this
Hi @SND0912
Try this:
Assign activity:
s1 = "LUCILA U UDARBE"
s1 = String.Join(" ", s1.Split(" ".ToCharArray, StringSplitOptions.RemoveEmptyEntries))
Assign activity:
s2 = "RAMA D SITA "
s2 = String.Join(" ", s2.Split(" ".ToCharArray, StringSplitOptions.RemoveEmptyEntries))
Hope it helps!!
Hi @SND0912
If your query is to remove the spaces in the middle of string if it have multiple spaces, starting and ending of a string as extra spaces. Use the below one,
- Assign -> s1 = "LUCILA U UDARBE"
- Assign -> output = System.Text.RegularExpressions.Regex.Replace(s1, "\s+", " ").Trim()
- Assign -> s2 = "RAMA D SITA "
- Assign -> output = System.Text.RegularExpressions.Regex.Replace(s2, "\s+", " ").Trim()
The above expressions will remove the extra spaces.
Check the below image for better understanding,
Hope it helps!!
Hi @SND0912
Assign activity:
s1 = System.Text.RegularExpressions.Regex.Replace(s1.Trim(), "\s+", " ")
Assign activity:
s2 = System.Text.RegularExpressions.Regex.Replace(s2.Trim(), "\s+", " ")
Hope it helps!!