Table of Contents

Class BrazilianDocumentConverters

Namespace
NuvTools.AspNetCore.Blazor.MudBlazor.Brazil.Converters
Assembly
NuvTools.AspNetCore.Blazor.MudBlazor.dll

Pre-configured converters for Brazilian documents and formats.

public static class BrazilianDocumentConverters
Inheritance
BrazilianDocumentConverters
Inherited Members

Remarks

Provides ready-to-use PatternStringConverter instances for common Brazilian document formats.

Properties

Cep

Converter for CEP (postal code) in format NNNNN-NNN.

public static PatternStringConverter Cep { get; }

Property Value

PatternStringConverter

Examples

01310-100

Cnpj

Converter for CNPJ (corporate taxpayer ID) in format AA.AAA.AAA/AAAA-NN. Supports the new RFB alphanumeric format (uppercase A–Z and 0–9 in positions 1–12) while remaining compatible with legacy numeric CNPJs.

public static PatternStringConverter Cnpj { get; }

Property Value

PatternStringConverter

Examples

12.345.678/0001-90 or 12.ABC.345/01DE-35

Cpf

Converter for CPF (individual taxpayer ID) in format NNN.NNN.NNN-NN.

public static PatternStringConverter Cpf { get; }

Property Value

PatternStringConverter

Examples

123.456.789-00

LandlinePhone

Converter for landline phone numbers in format (NN) NNNN-NNNN.

public static PatternStringConverter LandlinePhone { get; }

Property Value

PatternStringConverter

Examples

(11) 3333-3333

MobilePhone

Converter for mobile phone numbers in format (NN) NNNNN-NNNN.

public static PatternStringConverter MobilePhone { get; }

Property Value

PatternStringConverter

Examples

(11) 99999-9999

Methods

FormatCep(string?)

Formats a CEP for display.

public static string? FormatCep(string? value)

Parameters

value string

The raw CEP value.

Returns

string

The formatted CEP.

FormatCnpj(string?)

Formats a CNPJ for display.

public static string? FormatCnpj(string? value)

Parameters

value string

The raw CNPJ value.

Returns

string

The formatted CNPJ.

FormatCpf(string?)

Formats a CPF for display.

public static string? FormatCpf(string? value)

Parameters

value string

The raw CPF value.

Returns

string

The formatted CPF.

FormatCpfOrCnpj(string?)

Formats a CPF or CNPJ for display, automatically detecting the type by length (11 digits for CPF, 14 for CNPJ).

public static string? FormatCpfOrCnpj(string? value)

Parameters

value string

The raw CPF or CNPJ value.

Returns

string

The formatted CPF or CNPJ, or null if the value is empty or has an unrecognized length.

FormatLandlinePhone(string?)

Formats a landline phone number for display.

public static string? FormatLandlinePhone(string? value)

Parameters

value string

The raw phone number.

Returns

string

The formatted landline phone number.

FormatMobilePhone(string?)

Formats a mobile phone number for display.

public static string? FormatMobilePhone(string? value)

Parameters

value string

The raw phone number.

Returns

string

The formatted mobile phone number.

FormatPhone(string?)

Formats a phone number for display, automatically detecting if it's a mobile (11 digits) or landline (10 digits).

public static string? FormatPhone(string? value)

Parameters

value string

The raw phone number.

Returns

string

The formatted phone number in the appropriate format.