[Google Guava] string processing: Connector, splitter, character match

Source: Internet
Author: User
Tags google guava

First, the connector "Joiner"

Second, the splitter "Splitter"

Three, character match "Charmatcher"

  

Iv. Character Set "Charsets"

  charsets: The six character sets that are guaranteed to support all Java platforms provide a constant reference. Try to use these constants instead of getting character set instances by name.

    Try {            byte[] bytes = Test.getbytes ("UTf-8");         Catch (unsupportedencodingexception e) {            e.printstacktrace ();        }

Change to the following expression:

byte [] bytes = Test.getbytes (charsets.utf_8);

is actually equivalent to:

byte [] bytes = Test.getbytes (Charset.forname ("UTF-8"));

V. Uppercase and lowercase format "Caseformat"

Caseformat is used to easily convert strings between various ASCII case specifications, such as the naming conventions for programming languages. Caseformat supports the following formats:

Format Example
Lower_camel Lowercamel
Lower_hyphen Lower-hyphen
Lower_underscore Lower_underscore
Upper_camel Uppercamel
Upper_underscore Upper_underscore

String Testcaseformat = CaseFormat.UPPER_UNDERSCORE.to (Caseformat.lower_camel, "constant_name");

[Google Guava] string processing: Connector, splitter, character match

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.