CaseFormat Class | Guava | Java
CaseFormat is a utility class for converting between various ASCII case formats. Behavior is undefined for non-ASCII input.
Declaration: The declaration for com.google.common.base.CaseFormat is as:
@GwtCompatible public enum CaseFormat extends Enum
Below table gives the summary of Enum Constants and their description:

Below table gives the summary of methods of CaseFormat class and their description:

Example 1:
// Java code to show implementation // of CaseFormat Class methods import com.google.common.base.CaseFormat; class GFG { // Driver code public static void main(String args[]) { // A string variable named str String str = "geeks_for_geeks"; System.out.println("Original String: " + str); // "LOWER_UNDERSCORE" is a C++ variable // naming convention System.out.println("Lower Camel Format: " + CaseFormat .LOWER_UNDERSCORE .to(CaseFormat .LOWER_CAMEL, str)); // "UPPER_UNDERSCORE" is a Java and // C++ constant naming convention System.out.println("Upper Camel Format: " + CaseFormat .UPPER_UNDERSCORE .to(CaseFormat .UPPER_CAMEL, str)); } } |
Original String: geeks_for_geeks Lower Camel Format: geeksForGeeks Upper Camel Format: GeeksForGeeks
Example 2:
// Java code to show implementation // of CaseFormat Class methods import com.google.common.base.CaseFormat; import java.util.*; class GFG { // Driver code public static void main(String args[]) { // Get the enum constants with the // help of values() method System.out.println("The Enum constants " + "of CaseFormat Class are:\n" + Arrays .toString(CaseFormat .values())); } } |
The Enum constants of CaseFormat Class are:
[LOWER_HYPHEN, LOWER_UNDERSCORE, LOWER_CAMEL, UPPER_CAMEL, UPPER_UNDERSCORE]
Reference: Google Guava
Recommended Posts:
- BigIntegerMath Class | Guava | Java
- CharMatcher Class | Guava | Java
- Splitter Class | Guava | Java
- IntMath Class | Guava | Java
- Range Class | Guava | Java
- Optional Class | Guava | Java
- LongMath Class | Guava | Java
- Doubles Class | Guava | Java
- Booleans Class | Guava | Java
- Joiner class | Guava | Java
- Floats Class | Guava | Java
- Ordering Class | Guava | Java
- Shorts Class | Guava | Java
- Ints Class | Guava | Java
- Chars Class | Guava | Java
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


