Link to home
Start Free TrialLog in
Avatar of Meinhoonaa
Meinhoonaa

asked on

how to extract characters pass pipe delimeted string

My input string = ABCD|EFGH.

How do I retrieve values 'EFGH' from the input string past pipe delimeted.
ASKER CERTIFIED SOLUTION
Avatar of Korbus
Korbus

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of John_Vidmar
Assumes you have a string with at least one delimeter:
string str ="abcd|efgh";
String final_value=str.Split('|')[1]

Open in new window

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