In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces php how to remove characters before and after the string related knowledge, the content is detailed and easy to understand, the operation is simple and fast, has a certain reference value, I believe that after reading this php how to remove the string before and after the character article will have a harvest, let's take a look.
Removal method: 1, if before and after the same character, you can use trim () to remove, syntax "trim (string," character ")"; 2, if before and after the same character, you can use ltrim () and rtrim () to remove the syntax "ltrim (string, 'after the character'), 'before the character'".
Operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer
The method of removing characters before and after string in php
1. If the string is preceded by the same character, you can use the trim () function to remove it.
The trim () function removes white space characters or other predefined characters from both sides of the string. Syntax format:
Trim (string,charlist)
String: specifies the string to check.
Charlist: specifies which characters are removed from the string.
Return value: returns the modified string.
Example: remove the a character before and after the string
2. If the string is not the same character before and after the string, you can use the ltrim () and rtrim () functions to remove the string
The ltrim () function removes white space characters or other predefined characters on the left side of the string.
The rtrim () function removes white space characters or other predefined characters on the right side of the string.
The syntax of the ltrim () and rtrim () functions is similar to that of trim () above and can be referenced.
Example: remove the a character before the string and the b character after the string
This is the end of the article on "how to remove characters before and after a string in php". Thank you for reading! I believe you all have a certain understanding of "how to remove characters before and after the string in php". If you want to learn more, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.