Package io.jawk.jrt

Class StrNum

java.lang.Object
io.jawk.jrt.StrNum
All Implemented Interfaces:
Serializable

public final class StrNum extends Object implements Serializable
An input-derived scalar: text that may also act as a number, following POSIX "numeric string" (strnum) semantics. Input fields, getline results, split() pieces, and similar input-originated values are represented as instances of this class so comparisons and gawk's typeof() can distinguish them from plain string constants.

Instances are serializable so they can be retained in persistent memory.

See Also:
  • Method Details

    • isNumber

      public boolean isNumber()
      Returns whether this scalar's text parses as an AWK number, making it a strnum.
      Returns:
      true when the text is a valid AWK number
    • doubleValue

      public double doubleValue()
      Returns this scalar's numeric value.
      Returns:
      the parsed numeric value
    • toString

      public String toString()
      Overrides:
      toString in class Object