Solved

How to extract all characters after the first "_" (Easy)

Posted on 2009-04-13
2
472 Views
Last Modified: 2013-12-17
I know there are a few ways to do this, but what would be the simplest way to grab all characters after the first "_"?

Example:
string SomeString1 = "a_1234_dc_54";
string SomeString2 = "be_456_xy";

Results:
1234_dc_54
456_xy
0
Comment
Question by:_agx_
2 Comments
 
LVL 29

Accepted Solution

by:
anarki_jimbel earned 500 total points
Comment Utility
Something like:


            string s = "a_1234_dc_54";

            int index = s.IndexOf("_");

            string s2 = s.Substring(index + 1);

            char[] chars= s2.ToCharArray();

            MessageBox.Show(s2);

Open in new window

0
 
LVL 52

Author Closing Comment

by:_agx_
Comment Utility
Yes, that is what I was looking for. Thanks!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

772 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

14 Experts available now in Live!

Get 1:1 Help Now