String.Trim is not able to remove spaces between two words

Hello , im facing a wierd situation here , the String.Trim function is not able to remove spaces in between of words

here is the string for eg
“Pdl Delinquncy file”
After the trim it should be
“PdlDelinquencyfile”

But it still showing “Pdl Delinquency file” in the immediate panel

this source for the strings is from get text , and it is happening for each text that has been extracted from that particular UiElement

Here is a immediate panel screenshot

image

Hey @indiedev91 ,

The String.Trim function in UiPath is designed to remove leading and trailing spaces by default, not spaces within the string. To remove spaces within the string, you can use the String.Replace function.

Assign
Inputstring = “Pdl Delinquncy file”
InputString = inputString.Replace(" ", “”)

Hope it helps you !

Hi @indiedev91

String.Trim only removes leading and trailing spaces (whitespace) from the string, not spaces between words.
To remove spaces between words within a string, you should use the String.Replace method.

Input = "Pdl Delinquncy file"
Output = Input.Replace(" ", "")

Hope this helps!!

Okay Im So Sorry for this Dumb Question , i just used .Replace(" “,”")

@indiedev91

Hope it is clarified

If yes would recommend to close it

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.