forked from persian-tools/go-persian-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
phonenumbers
Amir Iranmanesh edited this page Aug 11, 2026
·
2 revisions
Validate Iranian mobile numbers, normalize their prefix, and resolve operator details.
import "github.com/amiranmanesh/go-persian-tools/phonenumbers"Accepted prefixes: +98, 98, 0098, 0 (or none).
phonenumbers.IsPhoneValid("09122221811") // true
phonenumbers.IsPhoneValid("+989122221811") // true
phonenumbers.IsPhoneValid("12903908") // falsephonenumbers.PhoneNumberNormalizer("09122221811", "+98") // "+989122221811", nildetails, err := phonenumbers.GetPhoneDetails("09123456789")
if err == nil {
details.GetOperator() // phonenumbers.MCI
details.GetBase() // base province
details.GetProvinceList() // covered provinces
details.GetModel() // sub-model, if any
details.GetSimTypeList() // []SimType{Permanent, ...}
}Errors: phonenumbers.ErrInvalidFormat, phonenumbers.ErrInvalidPrefix.
Supported operators: MCI, Irancell, RightTel, Taliya, ShatelMobile.
Packages
Project