c# - Substring with repeating character -
how substring sample combobox items
e11-143 - america --> america jc - political theory --> political theory
i tried this:
string test = combobox1.text.substring(combobox1.text.indexof('-') + 1).trim();
but result
e11-143 - america --> 143 - america jc - political theory --> political theory
use lastindexof
index of last occurrence of character:
string test = combobox1.text.substring(combobox1.text.lastindexof('-') + 1).trim();
Comments
Post a Comment