isFraction property

bool isFraction

Checks whether the string contains a valid representation of a fraction in the 'a/b' format.

Note that 'a' and 'b' must be integers.

Implementation

bool get isFraction {
  try {
    Fraction.fromString(this);

    return true;
  } on Exception {
    try {
      Fraction.fromGlyph(this);

      return true;
    } on Exception {
      return false;
    }
  }
}