Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

String question

Posted on 2004-04-20
4
Medium Priority
?
232 Views
Last Modified: 2011-09-20
I have a string such as
strAddress="509 Lincoln Drive";

How do I strip of the number and the space after it. It has got to be simple but I am a newby.

Jim
0
Comment
Question by:Jimbo456
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 10

Accepted Solution

by:
eternal_21 earned 1000 total points
ID: 10874793
The code,

  System.Text.RegularExpressions.Regex.Replace("509 Lincoln Drive", @"^\d*\s*", "")

will return "Lincoln Drive".
0
 
LVL 12

Expert Comment

by:dfiala13
ID: 10874816
A couple of ways...

If you want to work with the parts/pieces of the string you can use the Split method or use regular expressions.
If you just want to get rid of everything to the left of the first space and the first space this will do it...

strAddressNoNum = strAddress.Substring(strAddress.IndexOf(" ")+1);
0
 
LVL 10

Expert Comment

by:ptmcomp
ID: 10876041
The regular expression is safer. When there is no space the regex will not match but the Substring will raise an IndexOutOfRangeException.
0
 
LVL 23

Expert Comment

by:rama_krishna580
ID: 10876088
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

636 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