我最近遇到要處理 年齡的字串,我覺得我的寫法很冗長,
不知道有沒有更簡潔的寫法,比方用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."
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 175.98.20.173 (臺灣)
※ 文章網址: https://www.ptt.cc/bbs/EzHotKey/M.1674682430.A.957.html