主题:不太明白这段代码,请高手指点!谢谢!
这是一个判断输入的字符串有大写字母多少个,小写字母多少个,数字字符多少个,其它字符多少个的代码,是我看的教材上的,我不太明白,请那位大虾给逐句注释一下,不胜感谢!
dim a(4) as integer,ch as srting,instring as integer
dim i as integer
dim srt as string()={"大写字母","小写字母","数字字符","其它字符"}
instring=txtinput.text
for i=0 to instring.length-1
ch=instring.chars(i)
select case ch
case "A"to"Z"
a(0)=a(0)+1
case "a"to"z"
a(1)=a(1)+1
case "0"to"9"
a(2)=a(2)+1
case else
a(3)=a(3)+1
end select
next i
for i=0 to 3
txtoutput.text +=srt(i)+a(i).tostring+vbcrlf
next
dim a(4) as integer,ch as srting,instring as integer
dim i as integer
dim srt as string()={"大写字母","小写字母","数字字符","其它字符"}
instring=txtinput.text
for i=0 to instring.length-1
ch=instring.chars(i)
select case ch
case "A"to"Z"
a(0)=a(0)+1
case "a"to"z"
a(1)=a(1)+1
case "0"to"9"
a(2)=a(2)+1
case else
a(3)=a(3)+1
end select
next i
for i=0 to 3
txtoutput.text +=srt(i)+a(i).tostring+vbcrlf
next