In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
How to use regular expression to judge mobile phone number and license plate number in Android, aiming at this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible method.
The 170 code segment of the third-party operator
Add: Unicom 4G 176, China Telecom 4G 177, Mobile 4G 178
The regular expression functions written based on these are as follows:
Public static boolean isMobileNO (String mobiles) {String telRegex = "\\ d {} | []\ d {}"; if (TextUtils.isEmpty (mobiles)) return false; else return mobiles.matches (telRegex);}
Where:
"13\ d {9}" means that the first two digits are 1 and 3, followed by any 9 digits
"14 [57]\ d {8}" means that the first two digits are 1 and 4, the third is 5 or 7, followed by any 8 digits.
and so on.
License plate number
The regular expression of the license plate number has been online all the time, but it hasn't changed much:
Public static boolean isCarnumberNO (String carnumber) {/ * license plate number format: Chinese character + Amurz + bit Amurz or-(only ordinary license plate numbers, trainer cars and some army vehicles are not included) * / String carnumRegex = "[\ ue-\ ufa] {} [Amurz] {} [Amurz -] {}"; if (TextUtils.isEmpty (carnumber)) return false Else return carnumber.matches (carnumRegex);}
Of course, this regular expression has limitations, such as the first bit is only limited to Chinese characters, there are only 34 provincial Chinese character abbreviations; the license plate number does not have the letters I and O, to prevent confusion with 1, 0; some license plates can not be distinguished, and so on.
This is the answer to the question about how to use regular expressions to judge mobile phone numbers and license plate numbers in Android. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel for more related knowledge.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.