GithubHelp home page GithubHelp logo

apbertoletti / maoli Goto Github PK

View Code? Open in Web Editor NEW

This project forked from aueda/maoli

0.0 1.0 0.0 1.36 MB

Helper library for common Brazilian business rules (CPF, CNPJ, and CEP)

License: MIT License

C# 100.00%

maoli's Introduction

Maoli

Build Status Codacy Badge Coverage Status NuGet Version Maoli no fuget.org Join the chat at https://gitter.im/maoli-net/community BuitlWithDot.Net shield

Versão em português: LEIAME.md

Maoli is a C# helper library for common Brazilian business rules (CEP, CPF and CNPJ), compatible with .NET Framework 4.0 and above.

Currently implements:

  • CEP validation
  • CPF validation
  • CNPJ validation

For client-side validation of CPF and CNPJ, please see Maoli.js.

Documentation

Cep

Cep.Validate(string value) - checks if a string value is a valid CEP representation. Returns true if CEP string is valid; false otherwise.

if (Cep.Validate("99999-999"))
{
  Console.WriteLine("CEP is valid");
}

Cpf

Cpf.Validate(string value) - checks if a string value is a valid CPF representation. Returns true if CPF string is valid; false otherwise.

if (Cpf.Validate("999.999.99-99"))
{
  Console.WriteLine("CPF is valid");
}

Cpf.Complete(string value) - completes a partial CPF string by appending a valid checksum trailing. Returns a CPF string with a valid checksum trailing.

// outputs "99999999999"
var cpf = Cpf.Complete("99999999"));

Cnpj

Cnpj.Validate(string value) - checks if a string value is a valid CNPJ representation. Returns true if CNPJ string is valid; false otherwise.

if (Cnpj.Validate("99.999.999/9999-99"))
{
  Console.WriteLine("CPNJ is valid");
}

Cnpj.Complete(string value) - completes a partial CNPJ string by appending a valid checksum trailing. Returns a CNPJ string with a valid checksum trailing.

// outputs "99999999999999"
var cnpj = Cnpj.Complete("999999999999"));

NuGet Package

To install Maoli using NuGet, run the following command in the Package Manager Console:

Install-Package Maoli

See the NuGet website.

.NET Fiddles

The following .NET Fiddles are available to test Maoli:

Source Code

Source code is available at GitHub.

License

This project is licensed under the MIT License.

Author

Adriano Ueda @adriueda

maoli's People

Contributors

aueda avatar gitter-badger avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.