Help with dynamic string manipulation

Hi Community!

I have a dynamic folderPath. Could be:
1st C:\Users\Documents\UiPath\Folders\Files\Section OR
2nd C:\Users\Downloads\OneDrive\File\Section

Using substring currently but it wouldn’t work with 2 different folderPaths. Example, if I use folderPath= folderPath.substring(33, 11)
1st Would result in “\Files\Sec”
2nd result in “Section III”

folderPath will always end in Section I, II, III, IV, V, or VI and .zip

Is there a better method to use? Thank you!

Hey @Jessica_Moseley
Want you want to extract from these path strings

Section and the roman numeral after it

So either
Section I
Section II
Section III
Section IV
Section V
Section VI

Use Path.getfilenamewithoutextension(“path of file”)

1 Like

You got it. Thanks so much!!

1 Like

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