How to get substring

path: “\xxx\xxx\xxx\xxx\xxx\Professional Lists\2021\Rockie - Professional List 2021.xlsx”
want to get just “Rockie” from it.
Help me!!!

Hi

Hope this expression would help you resolve this

stroutput = Split(Split(Strinput.ToString,”\”).Last.ToString,”-“)(0).ToString.Trim

Cheers @anishakotian400

Hi ,
The filename can be taken separately and split the Name of file using the hyphen.

Path.GetFileNameWithoutExtension("\xxx\xxx\xxx\xxx\xxx\Professional Lists\2021\Rockie - Professional List 2021.xlsx").Split("-"c)(0).Trim.ToString

Thank you. It helped.

1 Like

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