请问如何用vbscript 实现如下序列生成:A001-A999; B001-B999 … … Z001-Z999; AA01-AA99; AB01-AB99 … … AZ01-AZ99;BA01-BA99,BB01-BB99,...,BZ01-BZ99,.............
參考答案:'A001-A999; B001-B999 … … Z001-Z999
dim X,Y,A,B,C(1 TO 26,1 TO 999),D(1 TO 26,1 TO 99),E(1 TO,26,1 TO 99)
for X=1 to 999
A=X
IF A<10 THEN A="00" + LTRIM(STR(A))
IF A>9 AND A<100 THEN A="0" + LTRIM(STR(A))
for Y=1 to 26
B=CHR(64+Y) '64+Y是A-Z的ANSI码,将它转换成A-Z的字符
C(X,Y)=B + A
NEXT X
NEXT Y
FOR X=1 TO 26
FOR Y=1 TO 999
PRINT C(X,Y)
NEXT X
NEXT Y
'BA01-BA99,BB01-BB99,...,BZ01-BZ99
for X=1 to 99
A=X
IF A<10 THEN A="0" + LTRIM(STR(A))
for Y=1 to 26
B=CHR(64+Y) '64+Y是A-Z的ANSI码,将它转换成A-Z的字符
E(X,Y)="B"+ B + A
NEXT X
NEXT Y
FOR X=1 TO 26
FOR Y=1 TO 99
PRINT E(X,Y)
NEXT X
NEXT Y
'AA01-AA99; AB01-AB99 … … AZ01-AZ99
for X=1 to 99
A=X
IF A<10 THEN A="0" + LTRIM(STR(A))
for Y=1 to 26
B=CHR(64+Y) '64+Y是A-Z的ANSI码,将它转换成A-Z的字符
D(X,Y)="A"+ B + A
NEXT X
NEXT Y
FOR X=1 TO 26
FOR Y=1 TO 99
PRINT D(X,Y)
NEXT X
NEXT Y