phone-number

Java regex phone number

泄露秘密 提交于 2019-12-10 10:37:25
问题 I am supplying the following regex : ^((?:\+27|27)|0)(\d{9})$ for number of South Africa and want to only return true for numbers that start with +27 or 27 or 0. eg; +27832227765, 27838776654 or 0612323434. I tried using: regexplanet.com and regex test But both return false no matter what I enter (even simple regex). Anybody know what I am doing wrong? 回答1: In Java code, you need to double the backslashes, and in a online tester, the backslashes must be single. Also, it is not necessary to

What is the best regular expression for phone numbers? [duplicate]

落爺英雄遲暮 提交于 2019-12-10 09:52:36
问题 This question already has answers here : Closed 6 years ago . Possible Duplicate: A comprehensive regex for phone number validation What regular expression will match valid international phone numbers? I've seen some posts on StackOverflow on regular expressions that match phone numbers. But many don't seem to take into account possible spaces or dashed between numbers to increase readability. I'm from the Netherlands, but I'd like to use a regex which matches any phone number, including

Automatically format phone number in EditText

让人想犯罪 __ 提交于 2019-12-10 02:39:51
问题 In my app, the user has to enter a phone number in an EditText field using the following format: 1(515)555-5555 I don't want the user to type "(", ")", or "-" while entering the number; I want these characters to be added automatically. For example, suppose the user typed 1 -- the parenthesis after "1" should be added automatically, so that "1(" would be displayed. And I would like to have similar functionality while deleting. I have tried to set text in the afterTextChanged method of

Formatting UITextField's text as Phone Number as user types in

梦想与她 提交于 2019-12-09 20:29:45
问题 I have a custom UITextField, which I am trying to 'format the input to phone number' as user types. What I want to achieve: Adding a prefixed + sign on the UITextField as the first character, that cannot be deleted. Format both the String variable and UITextField's text in the format of phone number nicely (+49 291 12345678) , rather than plain numbers (4929112345678) as user types in. I researched and found out that there is no built-in method for that. I've also found easy-to-use library

Paypal Express Checkout insists on phone number even though option turned off (calling from Magento)

两盒软妹~` 提交于 2019-12-09 18:10:54
问题 I'm using the Paypal 'Express Checkout' option in Magento. (I'm not using any express checkout buttons, it's just because I was having problem with returning from Website Payments Standard). In Paypal's Website Payment Preferences, I've set the 'Contact Telephone Number' field to off. I've also made a number of changes on the Magento side to make telephone number optional (as per this post). However, the telephone number field still appears during Paypal checkout, and is mandatory. Obviously,

iPhone address book phone numbers

荒凉一梦 提交于 2019-12-09 14:12:38
问题 I am doing an iPhone app in Xcode that needs phone book accessing. I need all phone numbers from address book and that should be stored in an NSArray . 回答1: //Also you need to include AddressBook.framework #import <AddressBook/AddressBook.h> #import <AddressBook/ABAddressBook.h> #import <AddressBook/ABPerson.h> [contactList removeAllObjects]; // open the default address book. ABAddressBookRef m_addressbook = ABAddressBookCreate(); if (!m_addressbook) { NSLog(@"opening address book"); } // can

Android: Detect currently active phone number during phone call

守給你的承諾、 提交于 2019-12-09 13:35:07
问题 Goal: On the Android platform, detect the phone number of the individual with whom the user is speaking to now. Currently, using PhoneListener, there exists a certain ambiguity in the case of calls on hold. Case: User is talking to someone during a call ("Call 1"). The user is therefore in call state OFFHOOK. Then the user is in state RINGING indicating an incoming phone call ("Call 2"). The state then changes to OFFHOOK. This could indicate one of two possibilities -- either the user

Get the user phone number with cordova / phonegap

安稳与你 提交于 2019-12-08 07:54:55
问题 I have installed this plugin : https://github.com/8enmann/TelephoneNumberPlugin/ and put this code in my angularjs controller: var telephoneNumber = cordova.require("cordova/plugin/telephonenumber"); telephoneNumber.get(function(result) { alert("result = " + result); }, function() { alert("error"); }); nothing happens and my code it's broken... i see it's a fork more recent than original and i thinked it's working good. I made a mistake or there is a bug with the most recent cordova version ?

stuck on a java phone number word generator

霸气de小男生 提交于 2019-12-08 06:22:37
问题 I have an assignment to generate every possible word from a 7 digit phone number and use PrintWriter to save it as a .txt file. My code is below but my output (currently just printing to console) is the same 3 "words" 2187 times. package ks2_Lab19; import java.util.Scanner; import java.io.PrintWriter; import java.io.FileNotFoundException; public class WordGenerator { private static String[] two = {"a", "b", "c"}; private static String[] three = {"d", "e", "f"}; private static String[] four =

best way to retrieve phone number?

两盒软妹~` 提交于 2019-12-08 00:49:44
问题 i need to be able to get the SIM's phone number, currently i have been using: telephonyManager = (TelephonyManager) getBaseContext().getSystemService(Context.TELEPHONY_SERVICE); tmPhone = telephonyManager.getLine1Number(); but this method doesnt always return a result/the correct result. is there anyway of getting the correct phone number 100% of the time, without asking the user to manually enter it? 回答1: Use This. TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY