All Projects → rustonaut → rust-phonenumber

rustonaut / rust-phonenumber

Licence: Apache-2.0 license
Library for parsing, formatting and validating international phone numbers.

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to rust-phonenumber

Stringformatter
Simple Text Formetter (Credit Card Number, Phone Number, Serial Number etc.) Can be used in all text inputs according to the format pattern. If desired, large minor character restrictions can be made in the format pattern.
Stars: ✭ 231 (+133.33%)
Mutual labels:  formatter, phone-number, validator
dockerfile-utils
A library and command line interface for formatting and linting Dockerfiles.
Stars: ✭ 17 (-82.83%)
Mutual labels:  formatter, validator
Anyformatkit
Simple text formatting in Swift
Stars: ✭ 296 (+198.99%)
Mutual labels:  formatter, phone-number
naija-phone-number
A fast minimal module to validate Nigerian mobile phone numbers using Regular Expressions.
Stars: ✭ 43 (-56.57%)
Mutual labels:  phone-number, validator
Input Mask Ios
User input masking library repo.
Stars: ✭ 494 (+398.99%)
Mutual labels:  formatter, validator
Brazilian Utils
Utils library for specific Brazilian businesses
Stars: ✭ 1,023 (+933.33%)
Mutual labels:  formatter, validator
Input Mask Android
User input masking library repo.
Stars: ✭ 1,060 (+970.71%)
Mutual labels:  formatter, validator
csv2vcf
🔧 Simple script in python to convert CSV files to VCF
Stars: ✭ 66 (-33.33%)
Mutual labels:  phone-number
Nebuchadnezzar
High Performance Key-Value Store
Stars: ✭ 49 (-50.51%)
Mutual labels:  rust-library
blackbricks
Black for Databricks notebooks
Stars: ✭ 40 (-59.6%)
Mutual labels:  formatter
flutter otp
A Flutter package for iOS and Android for sending and verifying OTP to a Phone number.
Stars: ✭ 59 (-40.4%)
Mutual labels:  phone-number
fixjson
JSON Fixer for Humans using (relaxed) JSON5
Stars: ✭ 96 (-3.03%)
Mutual labels:  formatter
palantir-java-format
A modern, lambda-friendly, 120 character Java formatter.
Stars: ✭ 203 (+105.05%)
Mutual labels:  formatter
hidapi-rs
Rust bindings for the hidapi C library
Stars: ✭ 103 (+4.04%)
Mutual labels:  rust-library
sql-formatter
Polyglot SQL formatter
Stars: ✭ 28 (-71.72%)
Mutual labels:  formatter
idea-uroborosql-formatter
Beautiful SQL Formatter for IntelliJ Platform
Stars: ✭ 18 (-81.82%)
Mutual labels:  formatter
twitter-stream-rs
A Rust library for listening on Twitter Streaming API.
Stars: ✭ 66 (-33.33%)
Mutual labels:  rust-library
contour-rs
Contour polygon creation in Rust (using marching squares algorithm)
Stars: ✭ 33 (-66.67%)
Mutual labels:  rust-library
arangors
Easy to use rust driver for arangoDB
Stars: ✭ 120 (+21.21%)
Mutual labels:  rust-library
TypeNameFormatter
A small .NET library for formatting type names à la C#.
Stars: ✭ 26 (-73.74%)
Mutual labels:  formatter

phonenumber Crates.io phonenumber License Build Status

Rust version of libphonenumber by Google.

Usage

Add this to your Cargo.toml:

[dependencies]
phonenumber = "0.1"

Example

The following example parses, validates and formats the given phone number.

extern crate phonenumber;

use phonenumber::Mode;
use std::env;

fn main() {
	let mut args = env::args().skip(1).collect::<Vec<_>>();

	if args.len() < 1 {
		panic!("not enough arguments");
	}

	let number  = args.pop().unwrap();
	let country = args.pop().map(|c| c.parse().unwrap());

	let number = phonenumber::parse(country, number).unwrap();
	let valid  = phonenumber::is_valid(&number);

	if valid {
		println!("\x1b[32m{:#?}\x1b[0m", number);
		println!();
		println!("International: {}", number.format().mode(Mode::International));
		println!("     National: {}", number.format().mode(Mode::National));
		println!("      RFC3966: {}", number.format().mode(Mode::Rfc3966));
		println!("        E.164: {}", number.format().mode(Mode::E164));
	}
	else {
		println!("\x1b[31m{:#?}\x1b[0m", number);
	}
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].