Solved

how to extract characters pass pipe delimeted string

Posted on 2014-01-06
3
280 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

717 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