CURP

Developed with passion by Pastel Code.

style: very good analysis


A package to easily validate and parse a Mexican CURP.

Features

  • A Curp object can be constructed via parse or tryParse.
  • Provides a isValidString static 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/.

Libraries

curp