ThaiIdStringExtension extension

Extension methods for String to easily validate and format Thai ID card numbers.

on

Properties

isValidThaiId bool

Available on String, provided by the ThaiIdStringExtension extension

Check if the string is a valid Thai ID card number.
no setter
isValidThaiIdFormatted bool

Available on String, provided by the ThaiIdStringExtension extension

Check if the string is a valid Thai ID card number (formatted).
no setter
thaiIdInfo ThaiIdInfo?

Available on String, provided by the ThaiIdStringExtension extension

Parse the Thai ID card number to extract information. Returns null if the ID is invalid (length check).
no setter

Methods

formatAsThaiId({String pattern = '1-2345-67890-12-3', String delimiter = '-'}) String

Available on String, provided by the ThaiIdStringExtension extension

Format the string as a Thai ID card number. Returns the original string if it cannot be formatted (e.g. not enough digits).