Difference between Split() and Substring()

Hello everyone,

I have to write a documentation about UiPath and I have to explain some functions. But I’m not sure about the differce between .split() and .substring(). So is it possible that someone tell me the difference in a simple way?

.split is used to break a string into an array wherever the specified character occurs. For example, for string “Hello| world”, if you use "Hello| world".Split("|"c), you’ll get an array as {"Hello", " world"}.

.substring is used to get part of the string at a starting index through a specified length. For example, to get “ello” out of “Hello| world”, you could use "Hello| world".SubString(1, 4). The first parameter is the character in the string starting with 0, and the 2nd parameter is the length. So index 1 points to the “e” in “Hello”, and 4 means to go out 4 characters, yielding “ello”.

4 Likes

Thank you very much! :smile:

1 Like

@Loons, for more detail you can refer following links from Microsoft itself:


Cheers

1 Like

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