Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42373

VS 2010 Getting the number from the string

$
0
0
Hi Guys.

I am looking for a little advice on how I can do something. Please give me your suggestions.

Pretend I have some string values like this:

Document1_789123456.docx

3rd_Notice_123456789_Final.pdf

001002003_SallySample_Upload.xls


I know I can use RegEx to find out if the strings have a nine digit employee number in the string. But I also want to get the 9 digit employee number from the file.

How would you recommend I get the 9 digit employee number? It’s important that I get all 9 digits. If the number if 8 digits long, then it’s not the employee number.

Since RegEx only tells me if the value exists (and not where in the string it exists), I was thinking maybe I could loop through the string and count how many numbers in a row I find.

What do you think? Is there a better way?

Viewing all articles
Browse latest Browse all 42373

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>