Used in today's project to remove the last character in a string
The original string 1,2,3,4,5,6,
Remove the last character "," and the end result is 1,2,3,4,5,6
The code is as follows:
Copy the Code code as follows:
$str = "1,2,3,4,5,6,";$newstr =
This article mainly introduces the substr () function parameter description and usage in PHP, analyzes the meaning of each parameter in the substr () function in the instance form, and illustrates its corresponding usage, and the friend who needs
SUBSTR (), substring (), slice () methods are often used to intercept strings, and sometimes confusing usage, so summarized.
Reading Table of ContentsSlice ()substring ()substr ()• Summary
Slice ()
Definition: Accepts one or two arguments, and
The use of Oracle's SUBSTR functionGets the string substr (string, start_position, [length]) of the specified starting position and length in the stringSuch as:SUBSTR (' This are a test ', 6, 2) would return ' is 'SUBSTR (' This are a test ', 6)
In today's project, we used to remove the last character in the string, so we used substr. we sorted it out to help you learn it. Used in today's project to remove the last character in the string
Original String 1, 2, 3, 4, 5, 6,
Remove the last
Used in today's project to remove the last character in the stringOriginal string 1, 2, 3, 4, 5, 6,Remove the last character "," and the final result is 1, 2, 3, 4, 5, 6.The Code is as follows:Copy codeThe Code is as follows:$ Str = "1, 2, 3, 4, 5, 6
Used today in the project to remove the last character in the string
The original string 1,2,3,4,5,6,
Remove the last character "," and the end result is 1,2,3,4,5,6
The code is as follows:
Copy Code code as follows:
$str = "1,2,3,4,5
1:update table Name set column name = SUBSTR (column name, INSTR (column name, ' match character ', "+1") Where condition like '%*% '2:select SUBSTR (column name, INSTR (column name, ', ', +1) as D from table name T where condition like '%-%
The substr (), the substring (), the Slice () method, and sometimes the use of confusion are often used when intercepting strings, so it is summarized.Slice ()Definition: Accepts one or two parameters, the first parameter specifies the starting
Php removes the usage of the last character substr () of the string. In today's project, remove the last character in the string from the original string 1, 2, 3, 4, 5, and 6. The final result is 1, 2, 3, 4, 5, and 6. the code is as follows: $ str
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.