添加电话号码前面有+号的检测兼容。

This commit is contained in:
ZhanGSKen 2025-02-25 20:50:03 +08:00
parent cedb5f521b
commit ac72132969
3 changed files with 11 additions and 3 deletions

View File

@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle #Created by .winboll/winboll_app_build.gradle
#Tue Feb 25 20:25:31 HKT 2025 #Tue Feb 25 12:48:19 GMT 2025
stageCount=15 stageCount=15
libraryProject= libraryProject=
baseVersion=4.1 baseVersion=4.1
publishVersion=4.1.14 publishVersion=4.1.14
buildCount=0 buildCount=1
baseBetaVersion=4.1.15 baseBetaVersion=4.1.15

View File

@ -35,6 +35,14 @@ public class SMSRecevier_Test {
szSmsAddress = "10000"; szSmsAddress = "10000";
test1(context, szSmsBody, szSmsAddress); test1(context, szSmsBody, szSmsAddress);
szSmsBody = "【UC】无影无迹";
szSmsAddress = "13172887736";
test1(context, szSmsBody, szSmsAddress);
szSmsBody = "【UC】无影无迹";
szSmsAddress = "+8613172887736";
test1(context, szSmsBody, szSmsAddress);
} }
public static void test1(Context context, String szSmsBody, String szSmsAddress) { public static void test1(Context context, String szSmsBody, String szSmsAddress) {

View File

@ -78,7 +78,7 @@ public class PhoneUtil {
return false; return false;
} }
//String text = "这里是一些任意的文本内容"; //String text = "这里是一些任意的文本内容";
String regex = "\\d+"; String regex = "[+]?\\d+";
Pattern pattern = Pattern.compile(regex); Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(szPhone); Matcher matcher = pattern.matcher(szPhone);
LogUtils.d(TAG, String.format("matcher.matches() : %s", matcher.matches())); LogUtils.d(TAG, String.format("matcher.matches() : %s", matcher.matches()));