Validations.Data 0.1.0

dotnet add package Validations.Data --version 0.1.0                
NuGet\Install-Package Validations.Data -Version 0.1.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Validations.Data" Version="0.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Validations.Data --version 0.1.0                
#r "nuget: Validations.Data, 0.1.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Validations.Data as a Cake Addin
#addin nuget:?package=Validations.Data&version=0.1.0

// Install Validations.Data as a Cake Tool
#tool nuget:?package=Validations.Data&version=0.1.0                

Métodos de extensão para a classe string. Provê um conjunto de validações e formatações para os mais variados tipos de dados como CNPJ, CPF, telefone e etc.

REQUISITOS

  • Dotnet Core 3.1 or higher
  • Visual Studio 2019
  • C# 6 ou superior

MÉTODO DE EXTENSÃO

Método Descrição
IsCNPJValid() Valida se a string é um CNPJ válido. Retorna um valor booleano(true ou false)
FormatCNPJ() Retorna uma string formato no estilo de um CNPJ. Ex: xx.xxx.xxx/xxxx-xx
IsCPFValid() Valida se a string é um CPF válido. Retorna um valor booleano(true ou false)
FormatCPF() Retorna uma string formato no estilo de um CPF. Ex: xxx.xxx.xxx-xx

COMO USAR

Para usar os métodos de extensão basta adicionar a referência do assembly (Validations.Data) ao seu projeto. Após adição os métodos de validação estão disponíveis para qualquer objeto do tipo string.

  • IsCNPJValid()
using Validations.Data;

namespace Exemple
{
    public class MyExemple
    {
        public bool ValidateCNPJ(string cnpj)
        {
            var isValid = cnpj.IsCNPJValid(); // returns true or false
            return isValid;
        }
    }
}
  • FormatCNPJ()
using Validations.Data;

namespace Exemple
{
    public class MyExemple
    {
        public string FormatCNPJ(string cnpj /* cnpj = xxxxxxxxxxxxxx */)
        {
            var formattedCnpj = cnpj.FormatCNPJ(); // returns xx.xxx.xxx/xxxx-xx
            return formattedCnpj;
        }
    }
}
  • IsCPFValid()
using Validations.Data;

namespace Exemple
{
    public class MyExemple
    {
        public bool ValidateCPF(string cpf)
        {
            var isValid = cpf.IsCPFValid(); // returns true or false
            return isValid;
        }
    }
}
  • FormatCPF()
using Validations.Data;

namespace Exemple
{
    public class MyExemple
    {
        public string FormatCNPJ(string cpf /* cpf = xxxxxxxxxxx */)
        {
            var formattedCpf = cpf.FormatCPF(); // returns xxx.xxx.xxx-xx
            return formattedCpf;
        }
    }
}
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.1 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETCoreApp 3.1

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.1.0 458 10/7/2020

## Version 0.1
- CNPJ Validation
- CNPJ formatting
- CPF Validation
- CPF formatting