vb中查找数字串并求和的代码怎么写 要求用mid取出字符 用布尔型数据判断 在线等 谢谢啦

2025-01-06 04:52:04
推荐回答(1个)
回答1:

dim s as string
s="418456safsdfs15s1df51sdf56sd"
dim Boo as Booleen
dim Sum as integer
for i=1 to len(s)
boo= Asc(mid(s,i,1))>=Asc(0) and Asc(mid(s,i,1))<=Asc(9)
if Boo=true then
sum=sum+mid(s,i,1)
end if
next