Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.text.TextUtils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {
    public static boolean isIDNumber(String id) {
        if (!TextUtils.isEmpty(id)) {
            Pattern pattern = Pattern
                    .compile("^[1-9]\\d{5}[1-9]\\d{3}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}([0-9]|X)$");
            Matcher matcher = pattern.matcher(id);
            return matcher.find();
        }
        return false;
    }
}