Skip to content

metinorak/TurkishId

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 

Repository files navigation

TurkishIdNumber Class

This is a class that contains a string for Turkish id number. It gets the value if it is valid, otherwise throws an exception. Generating an object using this class, you can keep the Turkish id numbers as objects and validate its value at the same time.

Usage

  • You must add turkishidnumber.h header file

Examples

TurkishIdNumber *tid = NULL;
try{
    tid = new TurkishIdNumber("10000000146");

}
catch(invalid_argument& ia){
    cerr<< "Invalid argument: " << ia.what()<<endl;
}
  • You can also change the value later:
try{
    tid->setValue("10000000148");

}
catch(invalid_argument& ia){
    cerr<< "Invalid argument: " << ia.what()<<endl;
}
  • And get the value using toString method.

  • You don't have to create an object. If you just want to validate the value, use static isValid method.

if(TurkishIdNumber::isValid("10000000146"){
    cout<<"The value is valid."<<endl;
}

About

Turkish ID number validator and holder class

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages