Good day all
I have a saved pdf file named 448473-032020
I want to be able to split it to get the date out which is 032020
fileName.Substring(fileName.Length-11).Replace(“.pdf”,“”) is pushing out -32020
Any better way to do this?
thanks
Good day all
I have a saved pdf file named 448473-032020
I want to be able to split it to get the date out which is 032020
fileName.Substring(fileName.Length-11).Replace(“.pdf”,“”) is pushing out -32020
Any better way to do this?
thanks
Your logic should not omit the “0” from “032020”. Are you actually getting value “-032020”?
In any case, if your filename is “448473-032020.pdf”, and you only want “032020”, assign a variable to:
System.Text.RegularExpressions.Regex.Match(MyStr, "(?<=-)\d+").Value
, where MyStr
is your string “448473-032020.pdf”.
Thanks it worked
The date is saved on an excel sheet, just realised that the number format takes away the 0.
It’s all good now, thanks a lot
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.