C language: Simulate the strstr function. If it is a substring, the string following the substring is output; otherwise, null is output.
# Define _ CRT_SECURE_NO_WARNINGS 1 # include
The syntax described below, when the usage scenario is to move a node in the tree, modifies the node and all parent nodes (Parentids) of its child nodes.Update trainstaff_dept Set parentids = replace (Parentids,#{oldpid},#{newpid}) where Companyid=#{companyid}Update trainstaff_dept Set Parentids=concat (#{newpid},substring (parentids,#{length}+1)) where substring (parentids,1 , #{length}) =#{oldpid} and Com
function substring:1. Intercept string from leftLeft (str, length)Description: Left (truncated field, intercept length)Example: Select Left (content,200) as abstract from my_content_t2, starting from the right to intercept the stringRight (str, length)Description: Right (truncated field, intercept length)Example: Select Right (content,200) as abstract from my_content_t3. Intercepting stringsSUBSTRING (str,
Result: blog.jb51
(Note: If the number of occurrences of the keyword is negative such as-2 is from the bottom to the end of the string)
Introduction to Functions:
SUBSTRING (Str,pos), SUBSTRING (str from POS) SUBSTRING (Str,pos,len), SUBSTRING (str from POS Forlen)
The format without the Len parameter returns a
"Alert (str. substring (-1,-5 ));--------""
Use split or slice ()
Function: split ()Function: uses a specified separator to split a string and store it in an array.Example:
The Code is as follows:
Copy code
Str = "jpg | bmp | gif | ico | png ";Arr = theString. split ("| ");// Arr is an array containing character values "jpg", "bmp",
The SUBSTRING function was used when manipulating SQL Server
SUBSTRING (expression, start, length)
Parameters
Expression
A string, binary string, text, image, column, or an expression that contains a column. Do not use an expression that contains aggregate functions.
Start
An integer or an expression that can be implicitly converted to int, specifying the start
an array using a specified delimiterExample:
The code is as follows
Copy Code
Str= "Jpg|bmp|gif|ico|png";Arr=thestring.split ("|");Arr is an array that contains the character values "JPG", "BMP", "GIF", "ico", and "PNG"
Function: John ()Function: Merges an array into a string using the separator of your choiceExample:
The code is as follows
Copy Code
Tags: hello BST binary return result SQL function return nbsp HTTP charDB2 left , right functionSyntax: Left (arg,length), right (Arg,length)The left and right functions return the leftmost, rightmost length string of arg, which can be a char or binary string.egSELECT Left (name,2), right (name,2) from T1ORACLE substr () functionSUBSTR (string, intercept start position, intercept length)//return intercepted wordsubstr (' Hello World ', 0, 1)//return r
How to use:
Copy Code code as follows:
Str.substring (start, end)
"String Literal". Substring (start, end)
Where "Start" indicates the starting position of the string to intercept, starting at 0.
"End" indicates the ending position of the string to intercept, starting at 0.
The substring () function method in JavaScript returns a string
Usage of Mysql string truncation function SUBSTRING description bitsCN.com feels that MySQL string function truncation characters are more powerful than program interception (such as PHP or JAVA), so here is a record, I hope it will be useful to you.
Function:
1. extract strings from the left
Left (str, length)
Note:
The sense that MySQL's string function intercepts characters is more powerful than using program interception (such as PHP or Java), so make a record here and hope to be useful to everyone.
Function:
1. Intercept string from left
Left (str, length)
Description: Left (intercepted field, intercept length)
Example: Select Left (content,200) as abstract from my_content_t
2, from the right start to intercept
When creating the view today, it is very convenient to use string Truncation in MySQL.
When creating the view today, it is very convenient to use string Truncation in MySQL.
I feel that the string function of MySQL intercepts characters, which is more powerful than program interceptions (such as PHP or JAVA). So I want to make a record here and hope it will be useful to everyone.
Function:
1. Extract stri
I feel that the string function of MySQL intercepts characters, which is more powerful than program interceptions (such as PHP or JAVA). So I want to make a record here and hope it will be useful to everyone.Function:1. Extract strings from the left Left (str, length)Note: left (truncated field, truncated length)Example: select left (content, 200) as abstract from my_content_t2. Extract strings from the right Right (str, length)Note: right (intercepte
Label:bloghttpos Use java forstrongspon It feels like MySQL's string function intercepts characters, and is more powerful than a program intercept (like PHP or Java), so make a record here and hope it works for everyone.Function:1. Intercept string from leftLeft (str, length)Description: Left (truncated field, intercept length)Example: Select Left (content,200) as abstract from my_content_t2, starting from the right to intercept the stringRight (str,
and today I learned a function.header files: #include The Strstr () function is used to retrieve the first occurrence of a substring in a string, with the following prototype:Char *strstr (char *str, char * substr);"Parameter description" STR is the string to retrieve, substr is the substring to retrieve.Return value returns the address of the first
stored in the ID value of 2, although formally in accordance with the format, But if you use select jl.* from the JL where Jl.id in (select Jlid from user where user.id=1) to query, it is not possible, he always returns the record with ID 1.So what do we do? If we were able to get 1 and 2 respectively, we could. Fortunately, MySQL also provides string intercept function substring.The SQL syntax is as follows: SELECT JL. * from JL WHERE jl.id = (SELEC
MySQL string intercept function: Left (), right (), substring (), Substring_index (). There is also mid (), substr (). where mid (), substr () is equivalent to the substring () function, the function of substring () is very powerf
returned substring is 3. Example
The following example demonstratesSubstringMethod usage.
Function substringdemo (){VaR SS ;//Declare variables.VaR S = "The rain in Spain falls mainly in the plain ..";Ss =S. substring (12,17);//Returns the substring.Return (SS );//Returns a substring.
To be different from the subs
|+---------------------------------+3.3 Starts from the 4th character position (reciprocal) of the string until it ends.mysql> Select substring (' sqlstudy.com ',-4); +-------------------------------+| SUBSTRING (' sqlstudy.com ',-4) |+-------------------------------+|. com |+-------------------------------+3.4 is taken from the 4th character position (
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.