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.