Documentation
¶
Overview ¶
Port of java/internal/prefixmapper/src/com/google/i18n/phonenumbers/prefixmapper/* (shared prefix lookup).
A Mapper resolves the value (carrier name, geocoding description, …) mapped to the longest matching numeric prefix of an E164 number. It is shared by the carrier and geocoding packages, each of which constructs one over its own embedded per-language data.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Mapper ¶
type Mapper struct {
// contains filtered or unexported fields
}
Mapper loads "<dir>/<language>.txt.gz" prefix maps from an embedded filesystem on demand, caching them per language. It is safe for concurrent use.
func (*Mapper) ValueForNumber ¶
ValueForNumber returns the value mapped to the longest matching prefix of the given E164 string (as produced by Format with E164, leading + included), along with the matched prefix, trying prefixes from maxLength digits downward. It returns "" and 0 if no prefix matches or the language has no data.