Substring difference method (C #, JS, Java, SQL) of

C#:

substring (the first parameter, the second parameter) // first parameter: Starting from several cut, initially beginning from the second parameter 0: intercepting several

substring (parameters) after a long if its argument is an integer and greater than or equal to 0, this places a starting position the entire length, all remaining taken as a string. Should the incoming values ​​less than 0, the system will throw ArgumentOutOfRange exception indicating parameters out of bounds.

JAVA:

substring (parameter) is taken in a method java string parameter passed in two ways

One is public String substring (int beginIndex) Returns a new string that is a substring of this string. The substring begins at the specified index from the character, until the end of the string.

Another is the public String substring (int beginIndex, int endIndex) Returns a new string that is a substring of this string. The substring begins at the specified beginIndex position until the index endIndex - 1 at the character. Thus, the length of the substring is endIndex-beginIndex.

JAVASCRIPT:

stringObject.substring(start,stop)

start Required. A non-negative integer, a predetermined position of the first character of the substring to be extracted in the stringObject. Starting position var str = "1234567890"; str.substring ( "2"); Output: 34567890

Optional stop. A non-negative integer, to extract the last character of the substring than a position in a multi stringObject. If omitted, then the substring will always return to the end of the string.

stringObject.substr(start,length)

start Required. To extract the substring starting index. It must be numeric. If it is negative, then the parameter declaration from the end of the string since the beginning of the position. That is, the value of -1 means the last character in the string, -2 means penultimate characters, and so on.

length optional. The number of characters in the string. It must be numeric. If this parameter is omitted, the return from the start position to the end stringObject string.

SqlServer:

SUBSTRING ( expression, start, length )

expression string, binary string, text, images, comprising a column or column expression. Do not use expressions that contain aggregate functions.

or may start an integer implicitly converted to int expression that specifies the start position of the substring.

length integer or may implicitly converted to int expression specified length of the substring (but not necessarily result returned length character length, depending on the length and the start of the expression provided !!!!!!!!!!! ).

Reproduced in: https: //www.cnblogs.com/Alenliu/p/substring.html

Guess you like

Origin blog.csdn.net/weixin_34310369/article/details/93470070