Class Strings

java.lang.Object
app.babylon.text.Strings

public final class Strings extends Object
  • Constructor Details

    • Strings

      public Strings()
  • Method Details

    • toCamelUpperPreserve

      public static CharSequence toCamelUpperPreserve(CharSequence x)
    • leftPad

      public static CharSequence leftPad(CharSequence s, int size, char padChar)
    • rightPad

      public static CharSequence rightPad(CharSequence s, int size, char padChar)
    • isAlpha

      public static boolean isAlpha(char c)
    • isAlphaNumeric

      public static boolean isAlphaNumeric(char c)
    • isEmpty

      public static boolean isEmpty(CharSequence s)
    • isStripxEmpty

      public static boolean isStripxEmpty(CharSequence s, int start, int length)
    • indexOf

      public static int indexOf(CharSequence s, char c)
    • indexOf

      public static int indexOf(CharSequence s, int start, int length, char c)
    • indexOfAny

      public static int indexOfAny(CharSequence s, char c1, char c2)
    • indexOfAny

      public static int indexOfAny(CharSequence s, char c1, char c2, char c3)
    • indexOfAny

      public static int indexOfAny(CharSequence s, char c1, char c2, char c3, char c4)
    • indexOfAny

      public static int indexOfAny(CharSequence s, int start, int length, char c1, char c2)
    • indexOfAny

      public static int indexOfAny(CharSequence s, int start, int length, char c1, char c2, char c3)
    • indexOfAny

      public static int indexOfAny(CharSequence s, int start, int length, char c1, char c2, char c3, char c4)
    • lastIndexOf

      public static int lastIndexOf(CharSequence s, char c)
    • lastIndexOf

      public static int lastIndexOf(CharSequence s, int start, int length, char c)
    • isWholeNumber

      public static boolean isWholeNumber(CharSequence s)
    • isWholeNumber

      public static boolean isWholeNumber(CharSequence s, int start, int length)
    • isInt

      public static boolean isInt(CharSequence s)
    • isInt

      public static boolean isInt(CharSequence s, int start, int length)
    • isLong

      public static boolean isLong(CharSequence s)
    • isLong

      public static boolean isLong(CharSequence s, int start, int length)
    • strip

      public static CharSequence strip(CharSequence s)
      Unicode-aware edge stripping equivalent to String.strip() for CharSequence.
    • stripStart

      public static int stripStart(CharSequence s, int start, int length)
      Returns the inclusive start index of the trimmed slice after Unicode whitespace stripping.

      This is intended for slice-oriented parsing code that wants trimmed bounds without first creating a CharSequence.subSequence(int, int) view. Paired with stripEnd(CharSequence, int, int), callers can decide whether a slice changed and only materialize a subsequence if the downstream parser requires one.

      Typical usage:

      
       int strippedOffset = Strings.stripStart(s, offset, length);
       int strippedEnd = Strings.stripEnd(s, offset, length);
       if (strippedOffset < strippedEnd)
       {
           CharSequence candidate = s.subSequence(strippedOffset, strippedEnd);
       }
       

      This is generally preferable to a hypothetical strip(CharSequence, int, int) helper for low-level parsing, because it lets the caller keep control of whether a new view object is created.

    • stripEnd

      public static int stripEnd(CharSequence s, int start, int length)
      Returns the exclusive end index of the trimmed slice after Unicode whitespace stripping.

      The returned value follows the normal Java start/end convention used by CharSequence.subSequence(int, int) and String.substring(int, int):

      - start is inclusive

      - end is exclusive

      See Also:
    • stripx

      public static CharSequence stripx(CharSequence s)
      Unicode-aware edge stripping (like String.strip()) plus additional ingestion cleanup characters.
    • stripx

      public static CharSequence stripx(CharSequence s, int start, int length)