I need to extract two parts of a string and put them in a variable. For example, my format is “lastname,firstname-1234”. I need to extract the last name and put it in a variable and then extract 1234 and put it in a variable.
@path1
You can use the string split function.
Assuming your variable is called “myString” you can do:
myString.Split(","c).First to get lastname
myString.Split("-"c).Last to get 1234
","c is shorthand for ",".ToCharArray. The split function uses a character array, I prefer the c notation since it’s shorter.
Hi
In addition to what others mentioned hope this would help you in this as well
If the above input is stored in a string variable named str_input
Then in ASSIGN activity
str_lastname = Split(str_input,”,”)(0).ToString.Trim
Similarly for that number
Str_number = Split(str_input,”-“)(1).ToString.Trim
Where both str_lastname and str_number is a variable of type string
Cheers @path1