Solved

C# Extract word from string

Posted on 2014-04-24
2
365 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

830 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