Split string in uipath


#1

Hi
I have a string of 12 alphanumeric eg “1205as45asf8”
I want to split it by 2 and store it in array
eg
arr[0]=12
arr[1]=05
arr[2]=as
arr[3]=45
arr[4]=as
arr[5]=f8
Can anyone tell me how to proceed


#2

You can use the following expression which will return an array of strings inside an Assign Activity (make sure to switch the string in the example to your own):

RegularExpressions.Regex.Matches(“Radu12345678”, “.{2}”).Cast(OF Match).Select(Function(x) x.Value).ToArray

(make sure you import System.Text.RegularExpressions :slight_smile: )

Please note that if the number of characters is odd, the last one will be ignored, but this shouldn’t be an issue since you only have 12 characters.