Özgür ACAR Özgür ACAR - 1 year ago 81
C# Question

Split String and get desired part

Is there any way to get the portion of string after the last "_" forexample;

string1 = A_110_23_09_ABC

result1 = ABC

string2 = A_110_23_09_ABC_555

result2 = 555


Answer Source
var s = "A_110_23_09_ABC";
var result = s.Substring(s.LastIndexOf('_') + 1);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download