phone-number

jQuery custom validation: phone number starting with 6

杀马特。学长 韩版系。学妹 提交于 2019-11-27 18:58:05
问题 I have a form in which you have to input your phone number and other fields. I'm validating the form with jQuery Validate. To validate the phone number field I do: rules: { phone: { required: true, minlength: 9, number:true },.. But I need to check also that phone starts with 6. How can I do that? 回答1: You can add a custom validator jQuery.validator.addMethod("phoneStartingWith6", function(phone_number, element) { phone_number = phone_number.replace(/\s+/g, ""); return this.optional(element)

What is the best way for converting phone numbers into international format (E.164) using Java?

旧街凉风 提交于 2019-11-27 18:00:51
What is the best way for converting phone numbers into international format (E.164) using Java? Given a 'phone number' and a country id (let's say an ISO country code), I would like to convert it into a standard E.164 international format phone number. I am sure I can do it by hand quite easily - but I would not be sure it would work correctly in all situations. Which Java framework/library/utility would you recommend to accomplish this? P.S. The 'phone number' could be anything identifiable by the general public - such as * (510) 786-0404 * 1-800-GOT-MILK * +44-(0)800-7310658 that last one is

Block outgoing SMS by contentObserver

强颜欢笑 提交于 2019-11-27 16:47:44
问题 I want to block SMS by contentObserver . For that I want to get the phone number of the SMS first. What do I do to get the number? This is the code that I have, just counting the number of SMS. package com.SMSObserver4; import android.app.Activity; import android.database.ContentObserver; import android.database.Cursor; import android.net.Uri; import android.os.Bundle; import android.os.Handler; import android.provider.Contacts; import android.provider.Contacts.People.Phones; public class

Phone number format and validation library [closed]

谁说胖子不能爱 提交于 2019-11-27 12:52: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 the world, does anyone know of any reason that such a project would be infeasible? Such an API in any

Regular Expression Validation For Indian Phone Number and Mobile number

懵懂的女人 提交于 2019-11-27 12:51:49
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-]+$} For land Line Number 03595-259506 03592 245902 03598245785 you can use this \d{5}([- ]*)\d{6} NEW for all ;) OLD: ((\+*)(0*|(0 )*|(0-)*|(91 )*)(\d{12}+|\d{10}+))|\d{5}([- ]*)\d{6} NEW

Android get all contacts telephone number in ArrayList

怎甘沉沦 提交于 2019-11-27 12:05:19
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? Santhosh 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.getColumnIndex(ContactsContract.Contacts._ID)); if(Integer.parseInt(cursor.getString(cursor

Get iPhone phone number label from Address Book

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-27 11:43:02
问题 So I have a method to get all the contact phone numbers from the address book on the iPhone, but is there a way to get the phone number label? For example you can do this: And I'd be looking to modify my method to print out the label (such as iPhone/Home/mobile/etc). ABAddressBookRef addressBook = ABAddressBookCreate(); CFArrayRef all = ABAddressBookCopyArrayOfAllPeople(addressBook); CFIndex n = ABAddressBookGetPersonCount(addressBook); for( int i = 0 ; i < n ; i++ ) { ABRecordRef ref =

RegEx for valid international mobile phone number [duplicate]

爱⌒轻易说出口 提交于 2019-11-27 11:42:42
This question already has an answer here: What regular expression will match valid international phone numbers? 21 answers 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. Jannie Theunissen After stripping all characters except '+' and digits from your input, this should do it: ^\+[1-9]{1}[0-9]{3,14}$ If you want to be more exact with the country codes see this question on List of phone number country

Phone number validation Android

泪湿孤枕 提交于 2019-11-27 11:39:11
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 isValidPhoneNumber(String number) { for (char c : number.toCharArray()) { if (!VALID_CHARS.contains(c)) { return

mysql datatype for telephone number and address

懵懂的女人 提交于 2019-11-27 11:06:31
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 processing? Thanks for your advice. Well, personally I do not use numeric datatype to store phone numbers or