Class BigDecimals

java.lang.Object
app.babylon.text.BigDecimals

public final class BigDecimals extends Object
Parsing and extraction helpers for decimal text values.
  • Method Details

    • isDecimal

      public static boolean isDecimal(CharSequence s)
      Returns whether the supplied text could represent a decimal.
      Parameters:
      s - text to inspect
      Returns:
      true when the text can be normalised as a decimal
    • removeCommas

      public static String removeCommas(String s)
      Removes commas from a simple numeric string, leaving other text unchanged.
      Parameters:
      s - text to normalise
      Returns:
      comma-free text or the original value when no safe cleanup applies
    • parse

      public static BigDecimal parse(CharSequence s)
      Parses a decimal value from the supplied text.
      Parameters:
      s - text to parse
      Returns:
      parsed decimal or null
    • parseDouble

      public static Double parseDouble(CharSequence s)
      Parses a Double from the supplied text.
      Parameters:
      s - text to parse
      Returns:
      parsed double or null
    • extract

      @Deprecated(since="0.3.25", forRemoval=true) public static BigDecimal extract(CharSequence sentence)
      Deprecated, for removal: This API element is subject to removal in a future version.
      use TransformParseMode.ONLY_IN with parse(CharSequence) instead
      Extracts a single decimal value from a sentence-like string.
      Parameters:
      sentence - source text
      Returns:
      parsed decimal or null if none or more than one are found
    • extractDouble

      @Deprecated(since="0.3.25", forRemoval=true) public static Double extractDouble(CharSequence sentence)
      Deprecated, for removal: This API element is subject to removal in a future version.
      use TransformParseMode.ONLY_IN with parseDouble(CharSequence) instead
      Extracts a single double value from a sentence-like string.
      Parameters:
      sentence - source text
      Returns:
      parsed double or null if none or more than one are found
    • prepare

      public static BigDecimals.PreparedDecimal prepare(CharSequence s)
      Normalises a decimal candidate before final parsing.
      Parameters:
      s - text to prepare
      Returns:
      prepared decimal metadata or null
    • isWholeNumber

      public static boolean isWholeNumber(BigDecimal value)