[\u4e00-\u9fa5]{1}[A-Z]{1}[A-Z_0-9]{5}
成都網(wǎng)絡(luò)公司-成都網(wǎng)站建設(shè)公司成都創(chuàng)新互聯(lián)公司十載經(jīng)驗成就非凡,專業(yè)從事成都網(wǎng)站建設(shè)、網(wǎng)站建設(shè),成都網(wǎng)頁設(shè)計,成都網(wǎng)頁制作,軟文發(fā)布平臺,1元廣告等。十載來已成功提供全面的成都網(wǎng)站建設(shè)方案,打造行業(yè)特色的成都網(wǎng)站建設(shè)案例,建站熱線:18980820575,我們期待您的來電!
部隊的車牌號好像有特殊的,比如WJ01什么的,這個正則不包括
package demo;
import java.util.Scanner;
public class CarCard {
//浙A 杭州,浙B 寧波,浙C 溫州,浙D 紹興,浙E 湖州,浙F 嘉興,浙G 金華,浙H 衢州,浙J 臺州,浙K 麗水,浙L 舟山
//網(wǎng)上搜的,應(yīng)該是對的,這個東西應(yīng)該管你要
public static void main(String[] args) {
System.out.println("請輸入車牌號");
Scanner sc = new Scanner(System.in);
String carno = sc.next();
String t = carno.substring(0,2);
checkAddressByCarCard(t);
}
private static void checkAddressByCarCard(String no){
String a[]={"浙A","浙B","浙C","浙D","浙E","浙F","浙G","浙H","浙J","浙K","浙L"};
String b[]={"杭州","寧波","溫州","紹興","湖州","嘉興","金華","衢州","臺州","麗水","舟山"};
int index = 0;
for(int i = 0;i11;i++){
if(no.equalsIgnoreCase(a[i])){
index=i;
System.out.println("車輛所在地為:"+b[i]);
}
}
}
}
//不嚴(yán)謹(jǐn),但是基本功能實現(xiàn)了
public?static?void?main(String[]?args)?{
String?str=?"";
int?n=0;
int?c=0;
for?(int?i?=?0;?i??7;?i++)?{
if(flag()){
c++;
str+=c4??charA():charB();
continue;
}
n++;
str+=n5??charB():charA();
}
System.out.println(str);
}
private?static?boolean?flag(){
int?i=(int)?(Math.random()*1000);
return?i%2==0;
}
private?static?String?charA(){
??return?""+(char)(Math.random()*26+'A');
}
private?static?String?charB(){
??return?""+(int)(Math.random()*10);
}