What is the most efficient way of extract the leading numbers from a string?

What is the most efficient way of extract the leading numbers from a string?

Example: 1020D Main Street.
Intended result: 1020
LVL 1
chuang4630Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Kyle AbrahamsConnect With a Mentor Senior .Net DeveloperCommented:
Split the line by Space
Loop through the first element until isDigit != true
0
 
Kyle AbrahamsSenior .Net DeveloperCommented:
Actually just thought of a slighter faster way:

Loop from the BACK of the array to the front while isdigit = false

the rest from 0 to element is your address
0
All Courses

From novice to tech pro — start learning today.