Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

C# Extract word from string

Posted on 2014-04-24
2
Medium Priority
?
412 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 2000 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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

886 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