CURP
Developed with passion by Pastel Code.
A package to easily validate and parse a Mexican CURP.
Features
- A
Curpobject can be constructed viaparseortryParse. - Provides a
isValidStringstatic method to check whether a string is a valid representation of a CURP.
Getting started
To start using the package is required to import it like following:
import 'package:curp/curp.dart';
Usage
Parse a string to a Curp object.
const curpString = '...';
Curp.parse(curpString); // It returns a Curp object or throws a FormatException.
Curp.tryParse(curpString); // It returns a Curp object or null.
Retrieve CURP string
After parsing a Curp object its value can be retrieved with:
final curp = Curp.parse('...');
final curpString = curp.toString();
Validate a CURP like string
Check whether a string is a valid CURP representation.
const curpString = '...';
final isValid = Curp.isValidString(curpString); // true or false
Additional information
For more information about CURP, head to official Mexican government website: https://www.gob.mx/curp/.