The IndexOf () method returns the location of the first occurrence of a specified string value in a string.
The LastIndexOf () method returns the last occurrence of a specified string value, which is searched forward at the specified position in a
Substr
An intercept string function in Oracle.
The syntax is as follows:
substr (String, start_position, [length])
Parameter analysis:
String
String value
Start_position
Intercepts the initial position of the string,
SUBSTR (string, intercept start position, intercept length)//return intercepted wordsubstr (' Hello World ', 0, 1)//return result is ' H ' * start with a string of length 1 from the first charactersubstr (' Hello World ', 1, 1)//Returns the result
Oracle Intercept string Function substrSubstr The Intercept string function in Oracle. The syntax is as follows: substr (String, start_position, [length]) Parametric analysis: String String value Start_position The initial position of the truncated
SUBSTR (string, intercept start position, intercept length)//return intercepted wordsubstr (' Hello World ', 0, 1)//return result is ' H ' * start with a string of length 1 from the first charactersubstr (' Hello World ', 1, 1)//Returns the result
Recently the whole front desk always more or less encounter some small problem of string interception, can't help looking carefully under. Let's take a look at some of the application experiences and differences between string interception methods
substr () functionNote: string str = "Hello";substr (0,4) = "Hell", does not contain the output of the 4th-bit element, and the strlen function outputs the length of the Terminator "" ".Programming Example: Enter a line of string to find the same
Substring methodReturns a substring at the specified position in a string object.Strvariable.substring (start, end)"String Literal". Substring (start, end)ParametersStartIndicates the starting position of the substring, starting at 0.EndIndicates
In PHP if I want to use substr () to intercept the string in English, if the inclusion of Chinese or English will be tragic, but we do not cut we can use other ways to solve.
PHP interception of Chinese string garbled, this is the recent discovery
The substr () function returns part of the string.
GrammarSUBSTR (String,start,length)The arg2 of the method and the arg2 of the other two methods simply represent different meanings, so they are singled out.
When arg1
echo substr ("Hello
stringobject.substring (start,stop) is used to extract characters from a string mediation between two specified subscripts.
Start Required. A non-negative integer that stipulates the position of the first character of the substring to be extracted
1, substring method: to extract the string intermediary between the two specified subscript the character substring (start,end)
Start and end positions, zero-based index
Parameter descriptionstart required. A non-negative integer that stipulates
Substring method
The substring method is used to extract characters from the string mediation between the two specified subscripts
SUBSTRING (start,end)
Start and end positions, zero-based index
Parameter descriptionStart Required. A
Gets the string substr (string, start_position, [length]) that specifies the starting position and length in the stringSuch as:Substr'This is a test',6,2) wouldreturn ' is'substr ('This is a test',6) wouldreturn 'Is a test'substr ('techonthenet',-3,3
The substring method is used to extract the character of a string intermediary between two specified subscriptsSUBSTRING (start,end)Start and end position, zero-based indexParameter descriptionStart Required. A nonnegative integer that specifies the
Abstract: During the development project, a problem occurs: the data obtained from the remote server is composed of a regular string, but what you want is not the string, it is a string, So it uses the powerful Oracle functions. My problem is this.
SUBSTR and substring are both JS intercept string functions, the two uses are very similar, the following is the syntax of the two examples:Substr methodReturns a substring of the specified length starting at the specified position.Stringvar.substr (
Example code, using the function substr and ICONV_SUBSTR,MB_SUBSTR
Copy the Code code as follows:
Intercept Chinese string script home _www.jb51.net
$STR = ' 123 Script House 456 welcome everyone's presence ';Echo substr ($str, 0,4);Echo
Select substr (memo, (instr (memo, ':',-1,1) + 1) from sfa_order_item where trunc (gmt_modified) = trunc (sysdate)
I personally understand some simple subtr usage
Substr ('field name', 3) Here it means to extract this field from the third digit
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.