Enum Class SmallCaps

java.lang.Object
java.lang.Enum<SmallCaps>
me.croabeast.takion.character.SmallCaps
All Implemented Interfaces:
Serializable, Comparable<SmallCaps>, java.lang.constant.Constable, CharacterInfo

public enum SmallCaps extends Enum<SmallCaps> implements CharacterInfo
An enumeration representing small capital letters as a specialized form of characters.

Each constant in SmallCaps implements CharacterInfo and provides a corresponding small capital character along with a default length used for display calculations. This enum also provides utility methods for stripping accents from characters and converting strings to small caps or back to their normal representations.

Example usage:


 // Convert a normal string to small caps:
 String smallCapsString = SmallCaps.toSmallCaps("Hello World");

 // Check if a character is in small caps:
 boolean isSmall = SmallCaps.isSmallCaps('ᴀ');

 // Convert a small caps string back to normal:
 String normalString = SmallCaps.toNormal(smallCapsString);
 

See Also:
  • Enum Constant Details

  • Method Details

    • values

      public static SmallCaps[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static SmallCaps valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getBoldLength

      public int getBoldLength()
      Returns the bold length of this character.

      Bold length is calculated as the defined length plus one.

      Specified by:
      getBoldLength in interface CharacterInfo
      Returns:
      the bold length.
    • toString

      public String toString()
      Returns the small capital character as a string.
      Overrides:
      toString in class Enum<SmallCaps>
      Returns:
      the small capital character in string form.
    • stripAccents

      public static String stripAccents(String string)
      Removes accents from the provided string.
      Parameters:
      string - the string from which accents should be removed.
      Returns:
      the string without any accents.
    • stripAccent

      public static char stripAccent(char character)
      Removes accents from the given character.
      Parameters:
      character - the character to process.
      Returns:
      the character without accent marks.
    • valueOf

      public static SmallCaps valueOf(char character)
      Returns the corresponding SmallCaps constant for the given character.

      Accents are stripped by default.

      Parameters:
      character - the character to convert.
      Returns:
      the corresponding SmallCaps constant, or null if no match is found.
    • isSmallCaps

      public static boolean isSmallCaps(char character)
      Checks if the provided character is represented as a small capital letter.
      Parameters:
      character - the character to check.
      Returns:
      true if the character is a small capital; false otherwise.
    • hasSmallCaps

      public static boolean hasSmallCaps(String string)
      Checks if the provided string contains any small capital letters.
      Parameters:
      string - the string to check.
      Returns:
      true if the string contains at least one small capital letter; false otherwise.
    • toSmallCaps

      public static String toSmallCaps(String string)
      Converts the provided string to its small capital form.
      Parameters:
      string - the input string.
      Returns:
      a new string where applicable characters are replaced with their small capital equivalents.
    • toNormal

      public static String toNormal(String string)
      Converts a small capital string back to its normal form.
      Parameters:
      string - the small capital string.
      Returns:
      a new string where small capital characters are replaced by their default (normal) counterparts.