Method slice string, substr, substring comparison

  1 three process parameters are representative of start of the substring, the parameter represents the end position of the slice 2 and the substring, and represented in the substr is a length of the substring;
  For negative attitude, when the parameter appears in position 1, slice substr and counted from the end, and the end of the counting does not support substring simply as 0; when the parameter appears in the second position, slice and the same process parameters substring 1: calculated from the end of the former, the latter is converted into 0, and substr depending on the length of the negative returns an empty string 0;
  the case of less than 1 parameter 2 parameter, substring biggest difference is that it will then swap the two parameters taken substring, substr second parameter represented by a length and therefore no exception, slice Zeng substring search the whole story is still normal position, if it returns the starting position in the back end of the empty string.

Guess you like

Origin www.cnblogs.com/wuqilang/p/11204642.html