How to remove empty line in a string

Hi guys,

I’m extarcting a string using "Get Text " activity

say string is “Hello_uipath”

But after extraction i’m trying print it,

It was like

Hello_uipath

There is a empty line at first and second line contains some unwanted spaces is there after text is there

I have used replace(Enviroment.newline,"") it was not working.
Also split and i trying remove 1st line not working…

Give me some idea guys!!

Regards,
Sriram

try variable.tostring.trim

3 Likes

hello @Sriram07

you can use trim() method to remove space form string
or you can use a regular expression to remove new line

string replacement = Regex.Replace(s, @"\t|\n|\r", "");

Thanks

7 Likes

Thanks for the fast reply,
Its worked

Thank you worked!!!

1 Like

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