Regular Expression preliminary _ scatter string

Source: Internet
Author: User

Scattered string

Please separate the following strings into strings consisting of numbers and characters

String s1 = "abc1234xyz667kkmd764tttt ";

A string consists of letters and numbers separated by letters. All letter segments and fields must be separated, that is:

Abc

1234

Xyz

667

Kkmd

764

Tttt

/**/Public class FenLi {public static void main (String [] args) {String s = "abc1234xyz667kkmd764tttt"; s = s. replaceAll ("([a-zA-Z]) ([0-9])", "$1, $2"); s = s. replaceAll ("([0-9]) ([a-zA-Z])", "$1, $2"); System. out. println (s); // you can use split to split the file normally .}}

Related Article

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.