java如何验证不同国家/地区的手机号码 3 周,4 日 Questions & Answers 3271 手机号码的长度因国家而异。厌倦了常规表达,但(例如:印度允许10位数字,而不是验证范围为7到9位的阿联酋)
# 1 楼答案 将此依赖项添加到pom中。xml <! https://mvnrepository.com/artifact/com.googlecode.libphonenumber/libphonenumber > <dependency> <groupId>com.googlecode.libphonenumber</groupId> <artifactId>libphonenumber</artifactId> <version>8.4.3</version> </dependency>
# 2 楼答案 你可以尝试使用谷歌的电话号码库。它包含isValidNumber函数,该函数提供“使用长度和前缀信息对某个地区的电话号码进行完整验证”。 https://github.com/googlei18n/libphonenumber
# 1 楼答案
将此依赖项添加到pom中。xml
# 2 楼答案
你可以尝试使用谷歌的电话号码库。它包含
isValidNumber
函数,该函数提供“使用长度和前缀信息对某个地区的电话号码进行完整验证”。 https://github.com/googlei18n/libphonenumber