isCurrency function

bool isCurrency (String input, { dynamic symbol: '\$', dynamic require_symbol: false, dynamic allow_space_after_symbol: false, dynamic symbol_after_digits: false, dynamic allow_negatives: true, dynamic parens_for_negatives: false, dynamic negative_sign_before_digits: false, dynamic negative_sign_after_digits: false, dynamic allow_negative_sign_placeholder: false, dynamic thousands_separator: ',', dynamic decimal_separator: '.', dynamic allow_decimal: true, dynamic require_decimal: false, dynamic digits_after_decimal: const [2], dynamic allow_space_after_digits: false })

Check if string input is a currency optional params symbol = "$" require_symbol = false allow_space_after_symbol = false symbol_after_digits = false allow_negatives = true parens_for_negatives = false negative_sign_before_digits = false negative_sign_after_digits = fasle allow_negative_sign_placeholder = false thousands_separator = ',' decimal_separator = '.' allow_decimal = true require_decimal = false digits_after_decimal = const 2 allow_space_after_digits = false

Implementation

bool isCurrency(
  String input, {
  symbol = '\$',
  require_symbol = false,
  allow_space_after_symbol = false,
  symbol_after_digits = false,
  allow_negatives = true,
  parens_for_negatives = false,
  negative_sign_before_digits = false,
  negative_sign_after_digits = false,
  allow_negative_sign_placeholder = false,
  thousands_separator = ',',
  decimal_separator = '.',
  allow_decimal = true,
  require_decimal = false,
  digits_after_decimal = const [2],
  allow_space_after_digits = false,
}) {
  return _regexBuild(
    symbol: symbol,
    require_symbol: require_symbol,
    allow_space_after_symbol: allow_space_after_symbol,
    symbol_after_digits: symbol_after_digits,
    allow_negatives: allow_negatives,
    parens_for_negatives: parens_for_negatives,
    negative_sign_before_digits: negative_sign_before_digits,
    negative_sign_after_digits: negative_sign_after_digits,
    allow_negative_sign_placeholder: allow_negative_sign_placeholder,
    thousands_separator: thousands_separator,
    decimal_separator: decimal_separator,
    allow_decimal: allow_decimal,
    require_decimal: require_decimal,
    digits_after_decimal: digits_after_decimal,
    allow_space_after_digits: allow_space_after_digits,
  ).hasMatch(input);
}