guava CaseFormat example 2022-06-16 07:38

There are many variable names that need to be processed when writing code. Using the following tool classes can easily convert variable names in various formats.

public class CaseFormatClient {
    public static void main(String[] args) {
        String lowerCamel = "lowerCamel";
        String lowerHyphen = "lower-hyphen";
        String lowerUnderscore = "lower_underscore";
        String upperCamel = "UpperCamel";
        String upperUnderscore = "UPPER_UNDERSCORE";
        System.out.println(, lowerCamel));
        System.out.println(, lowerHyphen));
        System.out.println(, lowerUnderscore));
        System.out.println(, upperCamel));
        System.out.println(, upperUnderscore));