The interception of strings in JS

Source: Internet
Author: User

How do I intercept a set of data when it needs to be removed from a group to meet the criteria?

Basic ideas:

① it through a specific symbol, a set of strings splicing, or with "," or "+", all the strings are stitched together, such as the following format "+aa+bb+cc+dd+ee+ff+"

② then needs to intercept the "EE" from the string above, judging the position of "+ee+" in the string, and then intercepting it, getting "+aa+bb+cc+dd" and "ff+"

③ two strings to be truncated with a "+" stitching.

④ after stitching to re-assign the value of the time needed to restore the string to the original state, that is, the removal of the string two "+", Return to "Aa+bb+cc+dd+ff", so as to facilitate the next operation, continue to add "+" in the first and last position, Otherwise, no subsequent edits will be possible without conforming to the next string format

It is also to be considered how to judge the initial string if it is empty

This is the whole idea.

The interception of strings in JS

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.