Determine if a string is all numerals
Posted on 2010-09-03
I am extracting an string of length 8 from a filename. I want to convert the string to a date so I need to check if it is composed of all numeric digits before I try to convert it or I will cause an error.
So basically I need to determine if the string is composed of all numeric digits or if there are some text digits instead.
"12345678" this is good
"1234r567" any combination with any amount letters is bad
I'll probably have to loop through the components and check to see if they are numeric.
I will use this in existing code to decide whether to process the file or delete it.