Solved

C# Extract word from string

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Problem to error 4 46
Host asp.net pages 5 25
Windows Media Player 2 16
Best resource to learn entity framework 2 5
Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

920 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

15 Experts available now in Live!

Get 1:1 Help Now