substring out of range

后端 未结 3 1309
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:34

    Read the documentation again, the second value is the length, not the index.

    As found on MSDN:

    public string Substring(
        int startIndex,
        int length
    )
    

提交回复
热议问题