Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/spagettikod/sweid

Go API to validate Swedish Personal Identification and Organisation Numbers
https://github.com/spagettikod/sweid

Last synced: about 1 month ago
JSON representation

Go API to validate Swedish Personal Identification and Organisation Numbers

Awesome Lists containing this project

README

        

# sweid
Go API to validate Swedish personal identification (personnummer) and
organisational (organisationsnummer) numbers. Specifications for these
identifiers can be found at the Swedish Tax Agency, http://www.skatteverket.se.

## Usage
Call one of the two methods to test a Personal Identification Number (ValidPN) or Organisation Number (ValidON).

Valid formats for Personal Identification Numbers:
* YYYYMMDD-NNNN
* YYMMDD-NNNN
* YYYYMMDDNNNN
* YYMMDDNNNN

Valid formats for Organisation Numbers:
* NNNNNN-NNNN
* NNNNNNNNNN

## Example
```
package main

import (
"fmt"
"github.com/spagettikod/sweid"
)

func main() {
if ValidPN("640823-3234") {
fmt.Println("Correct Personal Identification Number!")
} else {
fmt.Println("Invalid Personal Identification Number!")
}
}
```