Short numbers
Short numbers use a separate metadata path from full national numbers. Build an NF.Phone with country code and short national number, or pass raw strings for emergency checks.
NF.isPossibleShortNumber
Whether the number has a possible short-number length.
Signatures
global static Boolean isPossibleShortNumber(NF.Phone phone)Uses country code on the NF.Phone to pick metadata.
global static Boolean isPossibleShortNumberForRegion(NF.Phone phone, String regionCode)Explicit region when country code is ambiguous or you validate against a specific market.
Parameters
Parameters depend on the signature; see Signatures above.
| Name | Type | Description |
|---|---|---|
phone | NF.Phone | Short number (country code + short NSN). |
regionCode | String | Region (…ForRegion signature). |
Returns
true if possibly a short number.
Throws
None.
libphonenumber
ShortNumberInfo.isPossibleShortNumber(PhoneNumber) / isPossibleShortNumberForRegion
Example
NF.Phone shortFr = new NF.Phone().setCountryCode(33).setNationalNumber(1010L);Boolean possible = NF.isPossibleShortNumberForRegion(shortFr, 'FR');NF.isValidShortNumber
Whether the number is a valid short number.
Signatures
global static Boolean isValidShortNumber(NF.Phone phone)Validates using country code on the phone object.
global static Boolean isValidShortNumberForRegion(NF.Phone phone, String regionCode)Validates against a specific region.
Parameters
NF.isPossibleShortNumber.Returns
true if valid short number.
Throws
None.
libphonenumber
ShortNumberInfo.isValidShortNumber(PhoneNumber) / isValidShortNumberForRegion
Example
Boolean valid = NF.isValidShortNumber(shortFr);NF.expectedShortNumberCost
Expected cost category for a short number.
Signatures
global static NF.ShortNumberCost expectedShortNumberCost(NF.Phone phone)Cost from country code on the phone object.
global static NF.ShortNumberCost expectedShortNumberCostForRegion(NF.Phone phone, String regionCode)Cost for a specific region.
Parameters
NF.isPossibleShortNumber.Returns
NF.ShortNumberCost; see Types.
Throws
None.
libphonenumber
ShortNumberInfo.getExpectedCost(PhoneNumber) / getExpectedCostForRegion
Example
NF.ShortNumberCost cost = NF.expectedShortNumberCostForRegion(shortFr, 'FR');// cost → NF.ShortNumberCost.PREMIUM_RATENF.connectsToEmergencyNumber
Whether dialling this raw string connects to emergency services.
Signatures
global static Boolean connectsToEmergencyNumber(String rawNumber, String regionCode)Parameters
| Name | Type | Description |
|---|---|---|
rawNumber | String | Digits dialled (e.g. 112). |
regionCode | String | Region where the user is located. |
Returns
true if this connects to emergency services.
Throws
None.
libphonenumber
ShortNumberInfo.connectsToEmergencyNumber(String, String)
Example
Boolean emergency = NF.connectsToEmergencyNumber('112', 'FR'); // trueNF.isEmergencyNumber
Whether the raw string is an emergency number for the region.
Signatures
global static Boolean isEmergencyNumber(String rawNumber, String regionCode)Parameters
NF.connectsToEmergencyNumber.Returns
true if an emergency short code.
Throws
None.
libphonenumber
ShortNumberInfo.isEmergencyNumber(String, String)
Example
Boolean is112 = NF.isEmergencyNumber('112', 'FR');NF.isCarrierSpecificShortNumber
Whether the short number is carrier-specific.
Signatures
global static Boolean isCarrierSpecificShortNumber(NF.Phone phone)Uses country code on the phone object.
global static Boolean isCarrierSpecificShortNumberForRegion(NF.Phone phone, String regionCode)Checks against a specific region.
Parameters
regionCode on the ForRegion method.Returns
true if carrier-specific.
Throws
None.
libphonenumber
ShortNumberInfo.isCarrierSpecific(PhoneNumber) / isCarrierSpecificForRegion
Example
Boolean carrierOnly = NF.isCarrierSpecificShortNumberForRegion(shortFr, 'FR');NF.isSmsServiceForRegion
Whether the short number is an SMS service code in the region.
Signatures
global static Boolean isSmsServiceForRegion(NF.Phone phone, String regionCode)Parameters
Returns
true if an SMS service short code.
Throws
None.
libphonenumber
ShortNumberInfo.isSmsServiceForRegion(PhoneNumber, String)
Example
Boolean sms = NF.isSmsServiceForRegion(shortFr, 'FR');