phone-number

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

心已入冬 提交于 2019-11-26 18:19:22
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 thinking: String.Format("{0:###-###-####}", i["MyPhone"].ToString() ); but that does not seem to do the trick. ** UPDATE ** Ok. I went with this solution Convert.ToInt64(i["Customer Phone"]).ToString("###-###-#### ####") Now its gets messed up when the extension is less than 4 digits. It will fill in the numbers from the right. so 1112224444 333 becomes 11-221-244 3334 Any

Android get all contacts telephone number in ArrayList

大憨熊 提交于 2019-11-26 18:09:51
问题 I am trying to save all contacts telephone numbers in an ArrayList but I cant find a way how. Is there a way to get them instead of picking them one by one with ContactsContract? 回答1: ContentResolver cr = mContext.getContentResolver(); //Activity/Application android.content.Context Cursor cursor = cr.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null); if(cursor.moveToFirst()) { ArrayList<String> alContacts = new ArrayList<String>(); do { String id = cursor.getString(cursor

Phone number validation Android

∥☆過路亽.° 提交于 2019-11-26 18:01:54
问题 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(); if(entered_number.getText().toString().length()<10 || number.length()>13 || number.matches(regexStr)==false ) { Toast.makeText(MyDialog.this,"Please enter "+"\n"+" valid phone number",Toast.LENGTH_SHORT).show(); // am_checked=0; }` And I also tried this: public boolean

mysql datatype for telephone number and address

ぐ巨炮叔叔 提交于 2019-11-26 17:59:32
问题 I want to input telephone number in a form, including country code, extension create table if not exists employee( ` country_code_tel int(11), tel_number int(10), extension int(10), mobile bigint(20) ); If tel_number is larger than 15 bit, which datatype can I use, I'd better use Bigint(20) ? create table address( address varchar(255), city varchar(255), country varchar(255), post_code int(11) ); For example, if I have a country code for Canada I can use +2 or 002. Which is better for

Android: Retrieve contact name from phone number

主宰稳场 提交于 2019-11-26 17:28:19
I would like to retrieve the name of a contact associated with an incoming telephone number. As I process the incoming number in the broascastreceiver having a String with the name of the incoming caller would help my project greatly. I would think this involves a query using the sql WHERE clause as a filter, but do I need to sort the contacts? An example or hint would be of great assistance. Pentium10 For that you need to use the optimized PhoneLookup provider as described. Add the permission to AndroidManifest.xml : <uses-permission android:name="android.permission.READ_CONTACTS"/> Then:

Regular Expression Validation For Indian Phone Number and Mobile number

自作多情 提交于 2019-11-26 16:10:59
问题 I want to validate Indian phone numbers as well as mobile numbers. The format of the phone number and mobile number is as follows: For land Line number 03595-259506 03592 245902 03598245785 For mobile number 9775876662 0 9754845789 0-9778545896 +91 9456211568 91 9857842356 919578965389 I would like the regular expression in one regex. I have tried the following regex but it is not working properly. {^\+?[0-9-]+$} 回答1: For land Line Number 03595-259506 03592 245902 03598245785 you can use this

Phone number format and validation library [closed]

北城余情 提交于 2019-11-26 16:08:40
问题 This question asking for a phone number format API in Java got me wondering why such an API doesn't seem to exist. Given the number of validation classes available under Apache Commons, I would have thought such an API would be included. My question is, does anyone know of a phone number formatting/validation library available in any language that could be used as a model for a small Java open source project? Also, other than the large number of different phone number formats used throughout

RegEx for valid international mobile phone number [duplicate]

时光毁灭记忆、已成空白 提交于 2019-11-26 15:42:19
问题 This question already has answers here : What regular expression will match valid international phone numbers? (21 answers) Closed 4 years ago . I use Clickatell to send SMSes to clients' mobile phones. Is there a standardised regular expression for all valid mobile phone numbers, e.g. +27 123 4567? I'd roll my own, but I'm worried about missing an obscure, valid phone number format. 回答1: After stripping all characters except '+' and digits from your input, this should do it: ^\+[1-9]{1}[0-9]

US Phone Number Verification

假如想象 提交于 2019-11-26 14:44:16
问题 I have a website form that requires a US phone number input for follow up purposes, and this is very necessary in this case. I want try to eliminate users entering junk data 330-000-0000 . I have seen some options of third parties that validate phone numbers for you, however idk if that is the best option for this situation. However if you have every used one of these third parties and can make a recommendation that would also be greatly appreciated here. However I am considering checking the

Phone number formatting on iOS

谁说胖子不能爱 提交于 2019-11-26 14:05:32
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? wan This will help you Format (xxx) xxx-xxxx - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { int length = (int)[self getLength:textField.text]; //NSLog(@"Length = %d ",length); if(length == 10) { if(range.length == 0) return NO; } if(length == 3) { NSString *num = [self formatNumber:textField.text]; textField.text = [NSString