c# - Get number inside of a string and do a loop -


i want number of string, , separate string , number, , then, loop , call method number of times string says. string has have structure: "abj3" (only 1 number accepted , 3 characters before it)

this code, repeat hundred of times, don't know why

            int veces = 0;             (int = 0; < m.length; i++)             {                 if (char.isdigit(m[i]))                     veces = convert.toint32(m[i]);             }              if (m.length == 4)             {                 (int = 0; <= veces; i++)                 {                     m = m.substring(0, 3);                     operaciones(m, u, t);                     thread.sleep(100);                 }             }             operaciones(m,u,t);             if (u.length >= 14)             {                 u = u.substring(0, 15);             } 

some please?

you have convert m[i] tostring() right sending char value convert.toint32 , higher value (9 = 57 example)

char t = '9';  int te = convert.toint32(t.tostring());  console.writeline(te); 

this gives result of 9 but

char t = '9';  int te = convert.toint32(t);  console.writeline(te); 

gives result of 57

so need change

veces = convert.toint32(m[i]); 

to

veces = convert.toint32(m[i].tostring()); 

hope helped.

best regards //kh.


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -