format-phone-swedish
Module for formatting strings to Swedish phone numbers. For international phone numbers use format-phone instead.
Supports traditional grouping of telephone numbers. All two, three, and four digit area codes are supported as well.
Will remove +46
prefix code if present.
Installation
Use npm:
npm install --save format-phone-swedish
API
format-phone-swedish.format
(number: String, separator?: String) => String
Param | Description |
---|---|
number: String |
Input telephone number |
separator?: String |
The separator character to use. Default is " " |
Takes a phone number-like string and formats it to traditional Swedish grouping.
Usage
console // => "08 123 45 67" // Changes the area code separatorconsole // => "08-123 45 67" // Removes +46 country prefix and extension numbersconsole // => "08 123 45 67" // Adds missing 0console // => "08 123 45 67" // Supports number grouping for numbers without area codesconsole // => "112"console // => "1177"console // => "114 14"console // => "12 34 56"console // => "123 45 67"console // => "123 456 78"
License
MIT, Read more at the LICENSE file.