com.google.common.base

## Enum CaseFormat

- java.lang.Object
- - java.lang.Enum<CaseFormat>
  - - com.google.common.base.CaseFormat

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<CaseFormat>

      @CheckReturnValue
      @GwtCompatible
      public enum CaseFormat
      extends java.lang.Enum<CaseFormat>

  Utility class for converting between various ASCII case formats. Behavior is undefined for non-ASCII input.
  Since:
    1.0

- - ### Enum Constant Summary

    Enum Constants
    Enum Constant and Description
    `LOWER_CAMEL` Java variable naming convention, e.g., "lowerCamel".
    `LOWER_HYPHEN` Hyphenated variable naming convention, e.g., "lower-hyphen".
    `LOWER_UNDERSCORE` C++ variable naming convention, e.g., "lower_underscore".
    `UPPER_CAMEL` Java and C++ class naming convention, e.g., "UpperCamel".
    `UPPER_UNDERSCORE` Java and C++ constant naming convention, e.g., "UPPER_UNDERSCORE".

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Converter<java.lang.String,java.lang.String>` | `converterTo(CaseFormat targetFormat)` Returns a `Converter` that converts strings from this format to `targetFormat`.
    `java.lang.String` | `to(CaseFormat format, java.lang.String str)` Converts the specified `String str` from this format to the specified `format`.
    `static CaseFormat` | `valueOf(java.lang.String name)` Returns the enum constant of this type with the specified name.
    `static CaseFormat[]` | `values()` Returns an array containing the constants of this enum type, in the order they are declared.

    - ### Methods inherited from class java.lang.Enum

      `clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

    - ### Methods inherited from class java.lang.Object

      `getClass, notify, notifyAll, wait, wait, wait`

- - ### Enum Constant Detail

    - #### LOWER_HYPHEN

          public static final CaseFormat LOWER_HYPHEN

      Hyphenated variable naming convention, e.g., "lower-hyphen".

    - #### LOWER_UNDERSCORE

          public static final CaseFormat LOWER_UNDERSCORE

      C++ variable naming convention, e.g., "lower_underscore".

    - #### LOWER_CAMEL

          public static final CaseFormat LOWER_CAMEL

      Java variable naming convention, e.g., "lowerCamel".

    - #### UPPER_CAMEL

          public static final CaseFormat UPPER_CAMEL

      Java and C++ class naming convention, e.g., "UpperCamel".

    - #### UPPER_UNDERSCORE

          public static final CaseFormat UPPER_UNDERSCORE

      Java and C++ constant naming convention, e.g., "UPPER_UNDERSCORE".

  - ### Method Detail

    - #### values

          public static CaseFormat[] values()

      Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:

          for (CaseFormat c : CaseFormat.values())
              System.out.println(c);

      Returns:
        an array containing the constants of this enum type, in the order they are declared

    - #### valueOf

          public static CaseFormat valueOf(java.lang.String name)

      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
        `name` - the name of the enum constant to be returned.
      Returns:
        the enum constant with the specified name
      Throws:
        `java.lang.IllegalArgumentException` - if this enum type has no constant with the specified name
        `java.lang.NullPointerException` - if the argument is null

    - #### to

          public final java.lang.String to(CaseFormat format,
                            java.lang.String str)

      Converts the specified `String str` from this format to the specified `format`. A "best effort" approach is taken; if `str` does not conform to the assumed format, then the behavior of this method is undefined but we make a reasonable effort at converting anyway.

    - #### converterTo

          @Beta
          public Converter<java.lang.String,java.lang.String> converterTo(CaseFormat targetFormat)

      Returns a `Converter` that converts strings from this format to `targetFormat`.
      Since:
        16.0