Phone object
Parsed NF.Phone value object: country code, national number, extension. Open reference
The NF class is NumberForge’s public Apex API for phone numbers. It is an Apex port of Google libphonenumber: parsing rules, validation, formatting, regional metadata, and enrichment behavior follow the same library you may already know from Java or other language bindings. Method names and types are adapted to Apex (NF.Phone, NF.Format, and so on), but the underlying semantics match libphonenumber.
NF ships in the managed package as a global class. Call static methods directly (for example NF.parse(...)); you do not instantiate NF itself. NumberForge also adds a small product layer on top of the port, such as NF.orgDefaultRegion and NF.orgDefaultSaveFormat for org-wide defaults from NumberForge Configuration.
Each method page lists parameters, return values, an Apex example, and the corresponding libphonenumber class or method. For a complete linked list of every entry point, see the Method index.
Typical pattern in a before insert / before update trigger: parse with the org or record region, validate, then store E.164.
String region = NF.orgDefaultRegion != null ? NF.orgDefaultRegion : 'US';
try { NF.Phone phone = NF.parse(contact.Phone, region); if (NF.isValid(phone)) { contact.Phone = NF.format(phone, NF.Format.E164); }} catch (NF.ParseException e) { contact.Phone.addError('Enter a valid phone number.');}See Parsing, Validation, and Formatting.
For imports or web forms, use the string overload of NF.isPossible before you build an NF.Phone:
if (!NF.isPossible(rawPhone, 'IT')) { // skip or flag row}Scan Notes, email bodies, or chatter for dialable numbers:
for (NF.Match hit : NF.findNumbers(case.Description, 'US')) { System.debug(hit.rawString() + ' → ' + NF.format(hit.number(), NF.Format.E164));}See Text & typing.
After parsing a valid number:
NF.Phone phone = NF.parse(account.Phone, 'US');if (NF.isValid(phone)) { String place = NF.descriptionForValidNumber(phone, 'en_US'); String carrier = NF.carrierNameForValidNumber(phone, 'en');}See Enrichment.
Phone object
Parsed NF.Phone value object: country code, national number, extension. Open reference
Parsing & validation
Turn raw strings into structured numbers and check validity. Parsing · Validation
Formatting
E.164, national, international, and mobile-dial formats. Open reference
Text & typing
NF.findNumbers, NF.asYouType, and match iterators. Open reference
Enrichment
Carrier, geography, and time zones (offline metadata). Open reference
Short numbers
Emergency codes, premium short codes, SMS services. Open reference
Regions & metadata
Types & method index
Enums, exceptions, nested types, and a linked index of every method. Types · Method index
Parsing, validation, and formatting use in-memory regional metadata. Enrichment (carrier, geography, time zones) loads additional offline static resources on first use in a transaction. Avoid calling enrichment methods in tight loops on very hot paths without caching results.
Enums (NF.Format, NF.NumberType, …) and NF.ParseException are listed on the Types page. Method pages link to them where relevant.