Split File Name of Excel File to create sheet name

Hi , i have different File names–
like—HDFC_ 57500000634417.xlsx,HDFC_ 57500000637417.xlsx

i want to split file name like–> HDFC 4417, HDFC 7417.
this split file name i have to create sheet name in excel.

How to Split ?

1 Like

@Anand_Designer You can take first four character and last four character from file name

Assign str_variable = sampleData.Substring(0,4) + " " + sampleData.Substring(sampleData.Length - 4)

image

1 Like

hi , file name–>“HDFC_ 57500000632417.xlsx”

i am getting output like–> HDFC xlsx

Change this solution to:

Assign str_variable = sampleData.Substring(0,4) + " " + sampleData.Substring(sampleData.Length - 9,4)

Changing the minus four, to minus 9 and adding ‘comma 4’.

I would recommend, that you train yourself in the basic string manipulations. For an example, you could have a look at this thread: How to manipulate a part of string: Split, Trim, Substring, Replace, Remove, Left, Right

1 Like

grafik

grafik

[CheatSheet] - System.Text.RegularExpressions | RegEx - News / Tutorials - UiPath Community Forum

1 Like

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