Skip to content

tknf/japhonex-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Japhonex Go

Japanese phone number checker for Go.

Installation

$ go get github.com/tknf/japhonex-go

Usage

In your Go app you can do something like:

import (
  "fmt"

  "github.com/tknf/japhonex-go"
)

func main() {
  result, err := japhonex.OptionalHyphen("<Phone number input>")

  if err != nil {
    fmt.Println(err)
  }

  if result == true {
    // validation is passed
  }
}

Hyphen validation patterns

Optional

result, err := japhonex.OptionalHyphen("<Input>")
// 0xx-xxxx-xxxx or 0xxxxxxxxxx

Required

result, err := japhonex.RequireHyphen("<Input>")
// 0xx-xxxx-xxxx

No hyphen

result, err := japhonex.NoHyphen("<Input>")
// 0xxxxxxxxxx

Licence

MIT