Solved

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

Posted on 2011-09-16
2
257 Views
Last Modified: 2012-05-12
What is the most efficient way of extract the leading numbers from a string?

Example: 1020D Main Street.
Intended result: 1020
0
Comment
Question by:chuang4630
  • 2
2 Comments
 
LVL 40

Accepted Solution

by:
Kyle Abrahams earned 500 total points
ID: 36550095
Split the line by Space
Loop through the first element until isDigit != true
0
 
LVL 40

Expert Comment

by:Kyle Abrahams
ID: 36550114
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

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Error in JQuery 5 53
Close form "before" open 3 40
compare between entities in entity framework 8 73
VB.NET 2008 Winforms Signing 13 19
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question