正则表达式完成号码验证,^以某开头,[] 字符集(匹配中括号里面的任意字符),\d是任意一个数字,{n}表示出现了多少次,$结尾 手机号的正则 ^1[34568]\d{9}$,以1开头,第二个数字是34568,剩下九个都是数字,数字结尾 调用String对象的match( ...
正则表达式完成号码验证,
^以某开头,[] 字符集(匹配中括号里面的任意字符),\d是任意一个数字,{n}表示出现了多少次,$结尾
手机号的正则 ^1[34568]\d{9}$,以1开头,第二个数字是34568,剩下九个都是数字,数字结尾
调用String对象的match()方法,参数:正则(里面的斜杠\需要转义)
if (phone.matches("^1[34568]\\d{9}$")) { SQLiteDatabase db = SQLiteDatabase.openDatabase(path, null, SQLiteDatabase.OPEN_READONLY); Cursor cursor = db .rawQuery( "select location from data2 where id=(select outkey from data1 where id=?)", new String[] { phone.substring(0, 7) }); while (cursor.moveToNext()) { String address = cursor.getString(0); return address; } cursor.close(); }
原标题:[android] 手机卫士号码归属地查询完成
关键词:Android
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们:
admin#shaoqun.com
(#换成@)。