Split two file names from a string

Hi,

I have a string variable holding data of
var1=C:\Users\XXXX\XXXX\406e1c51889ae96dba236468b09d94bc646049d2.xlsxC:\Users\XXXX\Downloads\Collection Dump.xlsx

need to split data as
var2=C:\Users\XXXX\XXXX\406e1c51889ae96dba236468b09d94bc646049d2.xlsx
var3=C:\Users\XXXX\Downloads\Collection Dump.xlsx

Regards,
A Manohar

@Manohar1

Can you try this. Split(“String”,“C:”)

cheers :smiley:

Happy learning :smiley:

4 Likes

Hi @Manohar1,
If your delimiter is always “.xlsx”, then you can try this.

var1=C:\Users\XXXX\XXXX\406e1c51889ae96dba236468b09d94bc646049d2.xlsxC:\Users\XXXX\Downloads\Collection Dump.xlsx
var2 =System.Text.RegularExpressions.Regex.Split(var1,"(?<=.xlsx)")(0)
var3 =System.Text.RegularExpressions.Regex.Split(var1,"(?<=.xlsx)")(1)

Warm regards,
Nimin :slightly_smiling_face:

2 Likes

@pattyricarte & @nimin

Thanks

Regards,
A Manohar

1 Like

No worries
Happy to help here @Manohar1

Cheers

3 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.