How to use the trim, split, substring, remove

Hi All:

I’m a beginner for UiPath. When I searched “how to remove a part of string”, there were lots of ways to achieve the result I found. Trim, slip, substring, remove,replace, etc. Actually, I know none of them. So could you please tell me how to use them or where I can find the introduction for them.
Thanks in advanced !:grin:


You’ll be using string manipulation a LOT, so it’s wise to get acquinted with it :slight_smile:

Trim: removes leading or trailing spaces from a trim, or any other character (you can specify that as a parameter)
Substring: takes a part of the string, starting at your preferred index and then going for an x amount of characters. For example, if you have a string “Hello World” and you just want “Hello”, you’d work with: yourString.Substring(0, 5)
Remove: basically works the opposite way of substring. Where in substring you specify the part you want to keep, in remove you specify the part you want to get rid of.
Replace: replaces a part of the string with another string.

And I don’t know Slip, I don’t think that’s part of Visual Basic, the language UiPath uses.

For more info, visit the Microsoft Documentation on Visual Basic. And of course practise a lot, that’s the best way to get to know it.


Thanks you very much ! It’s very useful !

1 Like

Sorry, not “slip”, but “Split”
I am confused about the “split”, how to use split? Prefer a example for introduce.
Thanks in advanced !

1 Like

@Harvey You can check out with the following link for split


Thanks @indra, but could you tell the function of the “toCharArray” ?

1 Like

Hello @Harvey, the delimiters must be in Array of Characters format, so if you only have one delimiter (like " "), you need to convert it to Array of Characters.

str1 = str1.Split(" “.ToCharArray) is the same as
str1 = str1.Split({” "c})


The ‘Split’ method will split your string into an array of substrings. As a parameter you can pass in the character to split the string on. For example, if you pass in a space (’ '), the string will be split at every occurence of a space. In UiPath you can pass it as followes: str.Split(" "c)

You can also pass in an array of characters, like indra did. In that case it will split the string between the characters in the array. In this case it retrieves all the words between the spaces. He then selects the first word in the array (‘km’) by calling the index 0.

You can find more info here:

Thanks ! :grinning:

Thank you !:thinking::slightly_smiling_face:

1 Like

This tutorial having string operations tutorials


Hi All:
now I have the string (“Language”:“ZH”,“Email”:true," ) and I want to get the ZH, but sometime maybe the Language is ZHC(for example), not only two words. So how to cut the stirng ? Thanks in advance !

I need help:cold_sweat::tired_face:

Main.xaml (7.2 KB)

1 Like

Thanks !


Could u explain me as how could I get Client Name: India
and I only want India to be extracted.

yourString = yourString.Split(" ".ToCharArray)(2).ToString should do the trick. Here you split the string at every instance of a space, and then select the word at index 2, which is ‘India’.

1 Like

Thank u…So index 0 would be Client in this case if I am not wrong and yourstring would be the complete CLient name: India…rite…so we are splitting here using spaces…

Indeed :slight_smile: If you want to store the result in the new string, that’s also possible of course. Like this:

newString = yourString.Split(" ".ToCharArray)(2).ToString

Hey Karthik,

I have a string =“abc,def,ghi,jkl,mno,pqr,” and the result i want is to remove the last comma of the string,only the last one i.e. result = “abc,def,ghi,jkl,mno,pqr”

can you please revert on this query asap.