phonenumber

package module
v0.0.0-...-4442c12 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2023 License: MIT Imports: 1 Imported by: 0

README

Phonenumber

This library validates phone numbers

Installation

To install the sort package, you need to first install Go and set your Go workspace.

  1. You can use the below Go command to install sort
$ go get -u github.com/iqquee/phonenumber
  1. Import it in your code:
import "github.com/iqquee/phonenumber"

Note:

This only works with nigerian number at the moment. But I intend to cover all other country codes as well.

Quick start

# assume the following codes in example.go file
$ touch example.go
# open the just created example.go file in the text editor of your choice

Validate Phone Number

To validate a phone number, use the Parse() method

package main

import (
	"fmt"

	"github.com/iqquee/phonenumber"
)

func main() {

	number := "09132600841"
	num, err := phonenumber.Parse(number)
	if err != nil {
		fmt.Printf("This is the error: %v\n", err)
	}

	fmt.Printf("This is the new formatted number: %v\n", num)
    //Response: 2349132600841

}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(number string) (string, error)

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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