renatorozas / RMRUTValidator

Simple class to validate chilean security number, also known as RUT.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RMRUTValidator

Say Thanks

Simple class to validate chilean security number, also known as RUT.

Requirements

This class works fine with iOS >= 9.0 and OS X >= 10.7 applications (ARC required, of course).

Installation

Manual

Download and add RMRUTValidator.h and RMRUTValidator.m files to your XCode project.

Cocoapods

Create the Porfile file in your XCode project root directory with the following:

platform :ios, '9.0'

pod 'RMRUTValidator'

Then run:

pod install

How to use?

Import the RMRUTValidator.h file where you need to use it.

#import <RMRUTValidator/RMRUTValidator.h>

Then you validate a RUT like this:

if ([RMRUTValidator validateRut:@"19.200.923-5"]) {
  // Yay, the Rut is valid.
} else {
  // The rut is invalid. :(
}

Dots and hyphen are stripped from the RUT string by default so, the following formats are all valid:

[RMRUTValidator validateRut:@"19.200.923-5"]
[RMRUTValidator validateRut:@"19200923-5"]
[RMRUTValidator validateRut:@"192009235"]

About

Simple class to validate chilean security number, also known as RUT.

License:MIT License


Languages

Language:Objective-C 92.6%Language:Ruby 7.4%