How to get the last few letters/digits

Hi all, I am trying to retrieve the .pdf in the below path

C:\RPA\Project1\Inputs\example.pdf

Subsequently if the file type is different, it should be able to retrieve e.g. .xlsx, .png etc

Regards

Hi,

Do you need to get file extension? If so, the following expression will help you.

System.IO.Path.GetExtension(yourString)

image

Regards,

Ah yes that is just what I needed, thank you!

1 Like

FYI, the above expression returns extension as it is.
So it may be better to use ToLower or ToUpper method if you need to check extension as the following

 System.IO.Path.GetExtension(yourString).ToLower() = ".pdf"

Regards,

1 Like

Okay, thanks for the heads up!

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