Code: Select all
rmvfront(Str)
{
Str1 := Substr(Str, 1, 1)
If Str1 is not integer
Str := Substr(Str, 2)
Return Str
}
rmvback(Str)
{
Str1 := Substr(Str, 0, 1)
If Str1 is not integer
Str := Substr(Str, 1, Strlen(Str)-1)
Return Str
}
Rmvstr(Str) ;移除头尾非数字字符
{
Loop {
A1:=Substr(Str, 1, 1)
If A1 is not integer
{Str:=rmvfront(Str)
continue ;下个循环
}
If Substr(Str, 1, 1) is integer
break ;跳出loop
}
;msgbox % Str
Loop {
A1:=Substr(Str, 0, 1)
If A1 is not integer
{Str:=rmvback(Str)
continue ;下个循环
}
If Substr(Str, 0, 1) is integer
break ;跳出loop
}
;msgbox % Str
}
!w::
A:="25+3"
msgbox % A
A:=Rmvstr(A)
msgbox % A