c# - How to use Substring , to return an integer of all the values after the first char -


i have string assetnumber have following format c100200. need folloiwng:-

  1. get characters after first (e.g. 100200 using above example)

  2. convert substring integer

  3. return integer + 1

but not know how use sub-string characters after first char, , how convert string int? on appreciated.

var result = int32.parse("c100200".substring(1)) + 1; 

if have default value, if can't parse current string:

int result; if (!int32.tryparse("sdfsdf".substring(1), out result)) {     result = 42; }  result+=1; 

Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -