字符串提取

来源:百度知道 编辑:UC知道 时间:2024/05/29 19:21:40
有没有方法把字符串31*(22-5)+70 中的数字和字符提取数组中?
例如 a[0]=31 a[1]=* a[3]=( .......

'VBS写的
n=inputbox("请输入:","提示","31*(22-5)+70")
a=split(re(n))
for i=0 to ubound(a)-1
sm=sm & "a["&i&"]="&a(i) & vbcrlf
next
msgbox sm
function re(a)
set regex=new regexp
regex.pattern="[0-9]+|[^0-9]"
regex.global=true
set matchs=regex.execute(a)
for each match in matchs
re=re & match & " "
next
end function

用什么语言?