我想在Apple Automator中创建服务,将字符替换为其他字符。例如,如果我想转换电话号码格式:
+ X(XXX)XXX-XX-XX => XXXXXXXXXX
感谢。
答案 0 :(得分:0)
这是一个简单的AppleScript代码,您可以将其放入automator中,并将输出作为完整数字返回= XXXXXXXXXX
on run {input, parameters}
set inputNumber to input as text
set outputNumber to ""
if inputNumber begins with "+" then
-- The Number begins with a + so convert number
set noParts to the number of words of inputNumber
repeat with cPart from 3 to noParts
set outputNumber to outputNumber & word cPart of inputNumber
end repeat
end if
return outputNumber
end run
希望这有帮助!