Class Currencys

java.lang.Object
app.babylon.text.Currencys

public final class Currencys extends Object
Fast currency parsing helpers optimized for common major three-letter codes.

The hot path avoids intermediate String allocation for the built-in fast set of uppercase currency codes, then falls back to a trimmed and normalized parse for less common inputs.

  • Method Details

    • parse

      public static Currency parse(CharSequence s)
      Parses a currency from the whole character sequence.
      Parameters:
      s - source text
      Returns:
      parsed currency or null
    • parse

      public static Currency parse(CharSequence s, int start, int end)
      Parses a character slice into a Currency.

      The fast path is optimised for common major currencies already presented as three uppercase ASCII letters. Less common or messier inputs fall back to a normalised parse using Currency.getInstance(String).

      Parameters:
      s - the source text
      start - the start index
      end - the exclusive end index
      Returns:
      the parsed currency, or null when parsing fails