react-native-country-calling-code-extractor
A React Native library for extracting country calling codes and phone numbers without country codes, simplifying international phone number management in your app.
Installation
You can install this package via npm or yarn.
npm install react-native-country-calling-code-extractor
# or
yarn add react-native-country-calling-code-extractor
Usage
Import the library into your React Native project:
import { extractCallingCodeAndNumber } from "react-native-country-calling-code-extractor";
Extracting Country Calling Code and Number
To extract the country calling code and the phone number without the country code using your custom function:
import { extractCallingCodeAndNumber } from "react-native-country-calling-code-extractor";
const phoneNumber = "+1xxxxxxxxxx";
const { callingCode, numberWithoutCallingCode } =
extractCallingCodeAndNumber(phoneNumber);
console.log("Calling Code:", callingCode);
console.log("Phone Number without Country Code:", numberWithoutCallingCode);
License This library is licensed under the MIT License.