Solved

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

Posted on 2011-09-16
2
256 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Round up to 100% in .NET 10 79
Create XML 5 46
Authentication of Web Services 3 46
Do you know how I could save the image array ELEMENTS as individual *.tiff files ? 2 37
Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…
A short film showing how OnPage and Connectwise integration works.

937 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

Need Help in Real-Time?

Connect with top rated Experts

4 Experts available now in Live!

Get 1:1 Help Now