编写程序实现字符串的逆转功能,并统计字符串中大写字母和小写字母的个数。

来源:百度知道 编辑:UC知道 时间:2024/09/25 00:29:04
要求:以函数的方式实现逆转部分,并且采用数组名传递的方式。通过2个全局变量分别返回大写字母个数和小写字母个数。
在线等 多谢~

msgbox mystrreverse_Aa(inputbox("","","abCDeFGhizk"))

function mystrreverse_Aa(text)
d=0
for i=len(text) to 1 step -1
n=mid(text,i,1)
if asc(n)>=65 and asc(n)<=90 then d=d+1
mystrreverse_Aa=mystrreverse_Aa & n
next
x=len(text)-d
mystrreverse_Aa=mystrreverse_Aa &vbcrlf& "大写字母:" &d&"个" &vbcrlf& "小写字母:" &x&"个"
end function
'VBS写的