How to get characters from a string

Hi all,

I have a string (C:\RPA\Reports\Downloaded\IS34_10.12.2018.xlsx) which I would like to extract the characters after the last \ (ie. “IS34_10.12.2018.xlsx”).

Is this possible please?

Thanks,
Tony

You can use GetFileName method also, it will give you file name from given path

Path.GetFileName(yourString)

Thanks,
Prankur

the simplest way would likely to be to use the string split method

stringArray = string.Split(""(0))
stringArray(stringArray.length -1)

calling spit on a string will create an array of strings from the original string separated by the character you specify.

2 Likes