Giter Site home page Giter Site logo

mmphone's Introduction

Myanmar Phone Number Validator for Go

mmphone is a package for validating Myanmar phone numbers in Go, it supports Ooredoo, Atom, MPT, MyTel, and also supports Burmese aphabets.

Installation

Install mmphone with the following command

    go get github.com/devnla/mmphone

Usage/Examples

package main

import (
	"fmt"

	"github.com/devnla/mmphone"
)

func main() {
	phoneChecker := mmphone.NewMyanmarPhone()

	phoneNumbers := []string{
		"09977123456",   // Ooredoo
		"+959781234567", // ATOM
		"959440057616",  // MPT WCDMA
		"0949120059",    // MPT CDMA 450 MHz
		"0937128956",    // MPT CDMA 800 MHz
		"09678123456",   // MyTel
		"၀၉၇၇၅၅၄၁၇၉၄",  // ATOM in Burmese numerals
	}

	for _, phoneNumber := range phoneNumbers {
		fmt.Printf("Phone Number: %s\n", phoneNumber)

		// Sanitize phone number
		sanitizedNumber := phoneChecker.SanitizePhoneNumber(phoneNumber)
		fmt.Printf("Sanitized: %s\n", sanitizedNumber)

		// Validate phone number
		isValid := phoneChecker.IsValidMyanmarPhone(phoneNumber)
		fmt.Printf("Is Valid: %v\n", isValid)

		// Get telecom provider
		provider := phoneChecker.GetTelecomName(phoneNumber)
		fmt.Printf("Provider: %s\n", provider)

		// Get network type
		networkType := phoneChecker.GetPhoneNetworkType(phoneNumber)
		fmt.Printf("Network Type: %s\n\n", networkType)
	}
}

Running Tests

To run tests, run the following command

	go test

Acknowledgements

License

MIT

mmphone's People

Contributors

devnla avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.