I am trying to get the characters that appear before and after certain character ("-").
string val = "7896-2-5"; 7896-2-5 here I want to get the character that appear between the two dashes i.e. 2 string val = "4512-12-5"; 4512-12-5 so here 12,
the position of first appearance of
- is fixed from left side but the position of second appearance of
- is determined by the character in between the two
- , may be single digit or double digit number.
How can I get the characters?