How to split the string?

Dear all,

i have some files, the format of file’s name like [111111]xxxx , i want to get the string 111111, how could i
use the function split, anybody could give me a guide? thanks a lot in advance .

1 Like

Hello

You could use Regex and an Assign activity and do it one step.

Left of assign:
Str_Result

Right of assign:
System.Text.RegularExpressions.Regex.Matches(INSERTSTRINGVARIABLE,“(?<=[).*(?=])”)(0).ToString

Check this workflow for the same method but using the Matches activity:
Main.xaml (4.5 KB)
Preview the Regex results here

Properties pane of Assign activity:
image

Output Pane:
image

Cheers

Steve

Hi @chrisjiyiwei,

Using Split function you can try this below code:
Assign variable=yourvariable.Split(“]”.ToCharArray)
Variablename(0)

For your reference:split.xaml (5.0 KB)

Hope this hwlps, if it works mark as solution.

Thanks,
Neelima.

1 Like

Hello,
In this video I do a lot of stuff with String and 2 examples of Split:

6:45 Split string by character
8:50 Split string by string

Thanks,
Cristian Negulescu

Hey buddy
[UiPath String Manipulation | Substring Function | Yellowgreys - YouTube - YouTube]
Refer this video this may help you

Hi Friend ,

Please use this in assign activity >
System.Text.RegularExpressions.Regex.Replace(“[111111]”,“[^0-9]+”,“”) . It is tested and work definitely for your problem.

I have a String “B5”
i want to split this string to “5” only and convert this 5 from string to int32 type, how can i do it??

I have a String “B5”
i want to split this string to “5” only and convert this 5 from string to int32 type, how can i do it??

Hello @Aashutosh_Soni
Kindly use regex pattern
YourString=B5

Cint(System.Text.RegularExpressions.Regex.Match(YourString,"d+").ToString.Trim)

image

1 Like

i have a variable named - int number=500
i want to check if number is greater than 650 but smaller than 800
or say between 650&800,
How can i do so? also i am getting this error please help.

@Aashutosh_Soni Try this condition

650<number And number<800

Regards,
Gokul Jai

1 Like

Thank you @Gokul_Jayakumar , your solution worked like a charm.:tada:

Hi i want t o split this type of data (FROM$7.44/Each). these type of thousand rows in excel i want only $+price i want to split FROM and Each.

How can i solve this please guide