123456789101112131415161718192021222324252627282930313233343536373839404142 |
- /*
- * *************************************************
- * Copyright (c) 2018 QMTH. All Rights Reserved.
- * Created by Deason on 2018-07-23 15:05:46.
- * *************************************************
- */
- package cn.com.qmth.examcloud.app.utils;
- import java.util.Random;
- import java.util.UUID;
- public class StrUtils {
- public static String uuid() {
- return UUID.randomUUID().toString().replaceAll("-", "");
- }
- public static Integer randomNumber() {
- return randomNumber(100000, 999999);
- }
- public static int randomNumber(int min, int max) {
- Random random = new Random();
- return random.nextInt(max) % (max - min + 1) + min;
- }
- /**
- * 校验手机号码格式
- */
- public static boolean isMobile(String str) {
- return check(str, "^[1][3,4,5,6,7,8,9][0-9]{9}$");
- }
- public static boolean check(String str, String reg) {
- if (str != null && str.matches(reg)) {
- return true;
- }
- return false;
- }
- }
|