Question about string segmentation

Source: Internet
Author: User
Ask a string segmentation question & nbsp; I have a string that may contain +, & nbsp; +, & nbsp;-, & nbsp;-, & nbsp; & nbsp;, & nbsp;, & nbsp ;., & nbsp ;., & nbsp;:, & nbsp;: replace these characters with $ vowels & nbsp; array (+ ask a string segmentation question
I have a string that may contain "+", "+ ","-","-","","",". ",". ",": ",": ", I will replace them.

$ Vowels = array ("+", "+ ","-","-","","",". ",". ",":",":");
$ File_name = str_replace ($ vowels, "+", $ str );

As a result, a character such as "question ++ Xiao Zhao + cartoon talents group + swf" is displayed. However, I need the Chinese character section and ask how to separate it, or is my replacement method not applicable from the very beginning? thank you ~

Php string segmentation


------ Solution --------------------
Isn't that true? If you do not need +, str_replace ($ vowels, "", $ str );
Or even swf?
------ Solution --------------------
$ Arr = preg_split ('/[+] +/', $ file_name );
Print_r ($ arr );

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.