The CaseFormat class is a utility class for converting between various ASCII case formats -
Modification Symbol and type | Method and description | |
---|---|---|
Object | clone() Override Cloneable. |
|
boolean | equals(Object obj) Override equals. |
|
String. | Format (Double Number) Specialization of format. |
|
format(double number, StringBuffer toAppendTo, FieldPosition pos) | format(double number, StringBuffer toAppendTo , Specialization of FieldPosition pos) | p> format. |
Format (long number)Specialization of the | format. | |
format(long number, StringBuffer toAppendTo, FieldPosition pos) | Specialization of the format. |
import com.google.common.base.CaseFormat; public class GuavaTester { public static void main(String args[]) { GuavaTester tester = new GuavaTester(); tester.testCaseFormat(); } private void testCaseFormat() { String data = "test_data"; System.out.println(CaseFormat.LOWER_HYPHEN.to(CaseFormat.LOWER_CAMEL, "test-data")); System.out.println(CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, "test_data")); System.out.println(CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, "test_data")); } }
C:\Guava>javac GuavaTester.java
C:\Guava>java GuavaTester
testData testData TestData
The above is the detailed content of CaseFormat class in Java. For more information, please follow other related articles on the PHP Chinese website!