Space that cannot be removed by trim (), chr (161 ). When a user submits an article, it always appears.

Source: Internet
Author: User
Space that cannot be removed by trim (), chr (161 ). A user submits an article. Before the content of the string submitted by POST is written to the database, trim removes the leading and trailing spaces of each row. However, some paragraphs that are submitted to the database still have a short space before them. It cannot be removed. He is neither s nor nr. he uses the ord () function to query whether his value is equal to & nbsp; 161. but how can he remove the null at the beginning. ------ Space that cannot be removed by trim (), chr (161 ). A user submits an article.
Before the content of the string submitted by POST is written to the database, trim removes the leading and trailing spaces of each row. YesThe content submitted for writing to the database is still a small space before some paragraphs. It cannot be removed. It is neither \ s nor \ n \ r \ 0. Ord ()The value of the function query is equal to 161, but how to remove the null at the beginning.

------ Solution --------------------
Trim ($ s, "\ r \ n". chr (161 ))

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.