按键精灵生成车牌

Function randomCarNo()

Dim randomCarNo 
/*定义固定字符串 QWERTYUIOPASDFGHJKLZXCVBNM*/
words = "ABCDEFGHI"
province ="京津沪渝冀豫云辽黑湘皖鲁苏浙赣鄂甘晋陕吉闽贵粤青川琼宁新藏桂蒙港澳台"
nums = "1234567890"
 /*随机生成省份*/
Randomize
pIndex = Int((len(province)) * Rnd()) 
randomCarNo = Mid(province, pIndex+1, 1)  
  /*随机生成字母*/
Randomize
wIndex = Int((len(words)) * Rnd()) 
randomCarNo = randomCarNo & Mid(words, wIndex+1, 1)  
 /*随机生成数字*/
For i=0 To 5   
    Randomize
    nIndex = Int((len(nums)) * Rnd()) 
    randomCarNo = randomCarNo & Mid(nums, nIndex+1, 1)  
Next  
End Function

/*测试调用*/
For ti = 0 To 10
    result=   randomCarNo()
    TracePrint result
Next

你可能感兴趣的:(按键精灵生成车牌)