Friday, November 11, 2022

How to Split a String - Uipath

How UiPath split the string works


 The split() technique splits a string into an array of substrings. The split() method returns the new array. The split() method does now not change the original string. If (" ") is used as separator, the string is cut up between words.













Example #1 Simple Split

Here we will split the string into two for that we will be using the " " (spaces in between the lines) So will be having one array with two strings

Variable = "11 street"

Array_variable = split(Variable," ")










Example #2 New line split

Here we will split the string into two for that we will be using the newline So will be having one array with two strings

Variable = "11 

                    street"

Option 1 - 

Array_variable = Variable.Split(Environment.NewLine.TocharArray)


Option 2 -


Array_variable = Variable.Join(“-“,Variable .Split(Environment.NewLine.ToCharArray,StringSplitOptions.RemoveEmptyEntries))


Example #3 New line split


Variable = "11 

                    street"

Option 1 - 

Array_variable = Variable.Split(new string[ ] { “\r\n\r\n” },StringSplitOptions.RemoveEmptyEntries);



Last Blogs