Solved

how to extract characters pass pipe delimeted string

Posted on 2014-01-06
3
275 Views
Last Modified: 2014-01-06
My input string = ABCD|EFGH.

How do I retrieve values 'EFGH' from the input string past pipe delimeted.
0
Comment
Question by:Meinhoonaa
3 Comments
 
LVL 10

Accepted Solution

by:
Korbus earned 500 total points
ID: 39759870
somthing like this oughta do it (with a few assumptions):

String str ="abcd|efgh";
int a=str.IndexOf("|");
String final_value=str.Substring(a+1);
0
 
LVL 11

Expert Comment

by:John_Vidmar
ID: 39760057
Assumes you have a string with at least one delimeter:
string str ="abcd|efgh";
String final_value=str.Split('|')[1]

Open in new window

0
 

Expert Comment

by:Michael Reeve
ID: 39760170
Another approach might be to use LastIndexOf method which returns the last occurrence of a string or characters within the string.

string str = "ABCD|EFGH";
var stringResult = str.Substring(str.LastIndexOf('|') + 1);

Open in new window

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

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
A short film showing how OnPage and Connectwise integration works.

930 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

16 Experts available now in Live!

Get 1:1 Help Now