我最近遇到要处理 年龄的字串,我觉得我的写法很冗长,
不知道有没有更简洁的写法,比方用RegexMatch
我的写法是
text:="7y8m"
yposition:=instr(text,"y")
year:=substr(text,yposition-1)
mposition:=instr(text,"m")
mlength:=mposition-yposition-1
month:=substr(text,yposition+1,mlength)
Msgbox % "The age is" . year . "years" . month ."month old."