Questions tagged [phone-number]

A telephone number or phone number is a sequence of digits used to call from one telephone line to another in a public switched telephone network(PSTN). When telephone numbers were invented, they were short — as few as one, two or three digits — and were given orally to a switchboard operator. As phone systems have grown and interconnected to encompass the world, telephone numbers have become longer.

A telephone number or phone number is a sequence of digits used to call from one telephone line to another in a public switched telephone network. When telephone numbers were invented, they were short — as few as one, two or three digits — and were given orally to a switchboard operator. As phone systems have grown and interconnected to encompass the world, telephone numbers have become longer. In addition to telephones, they now access other devices, such as computers and fax machines.

1163 questions
969
votes
42 answers

How to validate phone numbers using regex

I'm trying to put together a comprehensive regex to validate phone numbers. Ideally it would handle international formats, but it must handle US formats, including the following: 1-234-567-8901 1-234-567-8901 x1234 1-234-567-8901 ext1234 1 (234)…
Nicholas Trandem
  • 2,795
  • 5
  • 28
  • 32
483
votes
14 answers

How to mark-up phone numbers?

I want to mark up a phone number as callable link in an HTML document. I have read the microformats approach, and I know, that the tel: scheme would be standard, but is quite literally nowhere implemented. Skype defines, as far as I know, skype: and…
Boldewyn
  • 75,918
  • 43
  • 139
  • 205
462
votes
19 answers

Programmatically obtain the phone number of the Android phone

How can I programmatically get the phone number of the device that is running my android app?
jkap
  • 4,822
  • 3
  • 14
  • 9
331
votes
9 answers

Programmatically get own phone number in iOS

Is there any way to get own phone number by standard APIs from iPhone SDK?
Vadim
  • 9,165
  • 7
  • 33
  • 58
213
votes
5 answers

What's the longest possible worldwide phone number I should consider in SQL varchar(length) for phone

What's the longest possible worldwide phone number I should consider in SQL varchar(length) for phone. considerations: + for country code () for area code x + 6 numbers for Extension extension (so make it 8 {space}) spaces between groups (i.e. in…
208
votes
5 answers

How do I get the dialer to open with phone number displayed?

I don't need to call the phone number, I just need the dialer to open with the phone number already displayed. What Intent should I use to achieve this?
Nik
  • 6,525
  • 7
  • 48
  • 73
170
votes
24 answers

How to format a string as a telephone number in C#

I have a string "1112224444' it is a telephone number. I want to format as 111-222-4444 before I store it in a file. It is on a datarecord and I would prefer to be able to do this without assigning a new variable. I was…
Brian G
  • 49,145
  • 57
  • 120
  • 139
126
votes
9 answers

Replace non-numeric with empty string

Quick add on requirement in our project. A field in our DB to hold a phone number is set to only allow 10 characters. So, if I get passed "(913)-444-5555" or anything else, is there a quick way to run a string through some kind of special replace…
Matt Dawdy
  • 17,805
  • 17
  • 60
  • 87
109
votes
20 answers

Formatting Phone Numbers in PHP

I am working on an SMS app and need to be able to convert the sender's phone number from +11234567890 to 123-456-7890 so it can be compared to records in a MySQL database. The numbers are stored in the latter format for use elsewhere on the site…
NightMICU
  • 8,490
  • 25
  • 84
  • 114
93
votes
23 answers

Calling a phone number in swift

I'm trying to call a number not using specific numbers but a number that is being called in a variable or at least tell it to pull up the number in your phone. This number that is being called in a variable is a number that I retrieved by using a…
Thomas Martinez
  • 1,461
  • 2
  • 13
  • 19
75
votes
10 answers

Which is best data type for phone number in MySQL and what should Java type mapping for it be?

I am using MySQL with Spring JDBC template for my web application. I need to store phone number with only digits (10). I am little bit confused about data type using data type. What is preferable data type for it in MySQL? What should be Java data…
Vishal Zanzrukia
  • 4,378
  • 3
  • 33
  • 69
70
votes
15 answers

Read all contacts' phone numbers in android

I'm using this code to retrieve all contact names and phone numbers: String[] projection = new String[] { People.NAME, People.NUMBER }; Cursor c = ctx.getContentResolver().query(People.CONTENT_URI, projection, null, null, People.NAME + "…
shuwo
  • 869
  • 2
  • 8
  • 7
65
votes
23 answers

Phone number formatting on iOS

I have a text field where the user enters data. It's a phone number field. If the user enters 1234567890, I want it displayed as (123)-(456)-7890 as the user types. How is this possible?
Moni Viki
  • 929
  • 1
  • 14
  • 20
63
votes
15 answers

Phone number validation Android

How do I check if a phone number is valid or not? It is up to length 13 (including character + in front). How do I do that? I tried this: String regexStr = "^[0-9]$"; String number=entered_number.getText().toString(); …
Udaykiran
  • 5,705
  • 9
  • 41
  • 75
62
votes
16 answers

Phone validation regex

I'm using this pattern to check the validation of a phone number ^[0-9\-\+]{9,15}$ It's works for 0771234567 and +0771234567, but I want it to works for 077-1234567 and +077-1234567 and +077-1-23-45-67 and +077-123-45-6-7 What should I change in…
Nir
  • 1,714
  • 3
  • 24
  • 39
1
2 3
77 78