damm

package module
v0.0.0-...-d0fac6d Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2016 License: MIT Imports: 0 Imported by: 0

README

Damm Algorithm

Damm is a small Go library which implements the Damm check digit algorithm.

Installation

go get github.com/umahmood/damm

cd $GOPATH/src/github.com/umahmood/damm

go test ./...

Usage

package main

import (
    "fmt"

    "github.com/umahmood/damm"
)

func main() {
    c := damm.Calc(572) // c = 5724

    fmt.Println(damm.Validate(c)) // output: true
}

Documentation

http://godoc.org/github.com/umahmood/damm

License

See the LICENSE file for license rights and limitations (MIT).

Documentation

Overview

Package damm implements the Damm check digit algorithm.

Example:

package main

import (
    "fmt"

    "github.com/umahmood/damm"
)

func main() {
    c := damm.Calc(572)

    fmt.Println(damm.Validate(c)) // output: true
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Calc

func Calc(n int) int

Calc calculates the check digit of n and appends it as a trailing digit to n.

func Validate

func Validate(n int) bool

Validate n against the included trailing check digit.

Types

This section is empty.

Jump to

Keyboard shortcuts

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