?
Solved

how to extract characters pass pipe delimeted string

Posted on 2014-01-06
3
Medium Priority
?
282 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 2000 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
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…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

752 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