Finding the first number in a string.

wxdqz

New Member
I'm wondering if there's some sort of built-in function that finds the first number in a string. For example, I would want 'var2_w5' to return 2. I tried parseInt and parseFloat, which I don't know much about, but they both returned 'NaN'.

Or would I have to do a loop that goes through the string until it finds a number?

Thanks, Alan.
 
Back
Top