Splitting Strings

Morning All

I have D:\Users\Robin\Documents\Mail Attachments\Himself\11-2018\BlankTestCV.pdf within a variable

I want to be able to split at the . so I only have the file extension

item.tostring.split and thats about as far as I have got? any ideas

Hi @Jersey_Practical_Sho

This will give you array

String.Split("."c)

Or smart solution would be

strExtension = Path.GetExtension("strYourFilePath")

Thanks,
Prankur

3 Likes

Hi @Jersey_Practical_Sho
extension = Path.GetExtension("D:\Users\Robin\Documents\Mail Attachments\Himself\11-2018\BlankTestCV.pdf ")
this is the best to get extension

1 Like