How To Split the PDF File Name "-" and get the third result?

Hi

I have multiple PDFs in 1 Folder, then the PDF name are in format (Ex: 008-088-888-20191219 101050.pdf), How To Split the PDF File Name “-” and get the third result?

FileName = Path.GetFileName(file)

WorkDayID = FileName.Split("-"c)

Regards,
Jason

Hi,

As you are getting the error because you are splitting which will give Array of String(String), but WorkDayID is type of single string, so you have to declare a temporary variable like

TempWorkDayID - String
WorkDayID - String

You have to assign WorkDayID - TempWorkDayID(Index).Tostring

Hope this clarify your question

Thanks

1 Like

WorkDayID(2) this shuold give the third number

Index starts with 0

Cheers @ArunVelaayudhanG

1 Like

var pdfData = “008-088-888-20191219 101050.pdf”.split("-")[2];
This will return 888”;
You wiil get the 3 index result.
Try this

1 Like

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