substring out of range

后端 未结 3 1313
Happy的楠姐
Happy的楠姐 2021-01-28 02:00

I am trying to extract the number out of the last part of the string, I have wrote a function to do this but am having problems with out of range index.

Here is the stri

3条回答
  •  心在旅途
    2021-01-28 02:14

    The second argument to Substring(int, int) isn't the "end position", but the length of the substring to return.

     result = property.Substring(startPos, endPos - startPos);
    

提交回复
热议问题