sweid

package module
v0.0.0-...-8bb7f0c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 4, 2016 License: BSD-3-Clause Imports: 3 Imported by: 0

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!")
	}
}

Documentation

Overview

Package sweid validates Swedish Personal Identification Number (personnummer) and Organisational Number (organisationsnummer).

More information about these identifiers can be found at the Swedish Tax Agency, http://www.skatteverket.se.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidON

func ValidON(on string) bool

ValidON validates a Swedish organisational number (organisationsnummer). Definitions can be found at http://www.skatteverket.se (search for organisationsnummer).

Example
if ValidON("212000-0142") {
	fmt.Println("Correct Organisational Number!")
} else {
	fmt.Println("Invalid Organisational Number!")
}
Output:

func ValidPN

func ValidPN(pn string) bool

ValidPN validates a Swedish personal identification number (personnummer). Definitions can be found at http://www.skatteverket.se (search for personnummer).

Example
if ValidPN("640823-3234") {
	fmt.Println("Correct Personal Identification Number!")
} else {
	fmt.Println("Invalid Personal Identification Number!")
}
Output:

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL