区分大小写的搜索并替换为AppleScript
我正在尝试编写一个小脚本,用AppleScript替换文本中的字符 不幸的是,AppleScript无法识别大小写 你知道如何考虑大小写吗区分大小写的搜索并替换为AppleScript,applescript,Applescript,我正在尝试编写一个小脚本,用AppleScript替换文本中的字符 不幸的是,AppleScript无法识别大小写 你知道如何考虑大小写吗 set input to "ApeAlexaBobBorder" set the clipboard to replaceText(input as string) on replaceText(textString) set prevTIDs to AppleScript's text item delimiters
set input to "ApeAlexaBobBorder"
set the clipboard to replaceText(input as string)
on replaceText(textString)
set prevTIDs to AppleScript's text item delimiters
set AppleScript's text item delimiters to "A"
set textString to text items of textString
set AppleScript's text item delimiters to ", A"
set textString to "" & textString
set AppleScript's text item delimiters to prevTIDs
return textString
end replaceText
您可以在
语句中对比较进行分组,例如:
considering case
set the clipboard to replaceText(input as string)
end considering
有关详细信息,请参阅。实际上考虑大小写
只影响文本比较(某个值等于其他值),而不影响文本项分隔符
相关内容。@vadian:文本项分隔符
尊重当前AppleScript中的“考虑”和忽略
属性versions@vadian,从他的回答中的链接:特殊注意事项因为文本项分隔符
(在版本中描述)尊重考虑
和忽略AppleScript 2.0中的属性,因此默认情况下分隔符不区分大小写。以前,它们总是区分大小写。若要强制执行前面的行为,请添加一个显式的考虑案例语句。@vadian Perfect。谢谢现在一切正常。