Substring_index of "MySQL" string interception

Source: Internet
Author: User

Substring_index (Str,delim,count)

STR: The string to be processed

Delim: Delimiter

Count: Count

Example: str=www.baidu.com

Substring_index (str, '. ', 1)

The result is: www

Substring_index (str, '. ', 2)

The result is: Www.baidu

That is, if Count is a positive number, then it is the left-to-right, and the left of the nth delimiter.

Conversely, if it is a negative number, it is all the content from the right to the right of the nth delimiter, such as:

Substring_index (str, '. ',-2)

The result is: baidu.com

Someone will for, if I ah in the middle of Baidu how to do?

Very simple, two directions:

From the right of the second delimiter to the right of all, and then from the left of the first delimiter:

Substring_index (Substring_index (str, '. ',-2), '. ', 1);

Substring_index of "MySQL" string interception

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.