Solved

C# Extract word from string

Posted on 2014-04-24
2
345 Views
Last Modified: 2014-04-29
Hi.

I am receiving a response from a web post method that comes in as one long string, eg:

"Data passed successfully - Item 4 |98765|01120| true"

I want to catch the data after the second "|", which in the example will be "01120".  Any ideas on how to do that?
0
Comment
Question by:Jasmin01
2 Comments
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 500 total points
ID: 40019962
Try:
string yourString = "Data passed successfully - Item 4 |98765|01120| true";
string[] parts = yourString.Split(new char[] { '|' });

string theValue = parts[2];

Open in new window

0
 

Author Closing Comment

by:Jasmin01
ID: 40028900
Thanks. This worked great!
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Bit flags and bit flag manipulation is perhaps one of the most underrated strategies in programming, likely because most programmers developing in high-level languages rely too much on the high-level features, and forget about the low-level ones. Th…
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…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

706 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

18 Experts available now in Live!

Get 1:1 Help Now