Substring after character C # [closed]

-5

Good Afternoon

string nr = ABC:1

I would like to get the number after ":", how would you do it?

nr = nr.substring(...);

Expected result:

for nr = ABC:50

nr = 50;

for nr = LKfasEWF:5039

nr = 5039
    
asked by anonymous 26.10.2018 / 20:56

1 answer

-1

To do this, just take the position that the character / string is, and then use the substring starting from that + 1 position. Here's an example.

string nr = "ABC: 1";

int posicaoCaractere = nr.IndexOf(": ");

nr = nr.Substring(posicaoCaractere+1);

MessageBox.Show(nr);
    
26.10.2018 / 21:09