这可能很简单,但我是一个总菜鸟,并且一直在寻找2个小时无济于事。
我需要更改此类型的列表:
0001,0002,0003等
进入这个:
0001
0002
0003
等
in applescript。
这就是我需要做的全部事情。请帮忙
答案 0 :(得分:0)
text item delimiters
是你的朋友
set theString to "0001, 0002, 0003"
set {TID, text item delimiters} to {text item delimiters, ", "}
set textItems to text items of theString
set text item delimiters to return
set theResult to textItems as text
set text item delimiters to TID
display dialog theResult buttons {"OK"} default button "OK"
如果您想要在示例中添加额外的空行,请添加第二个return
set text item delimiters to return & return
但是,如果源已经是一个列表,您可以省略几个步骤:
set theList to {"0001", "0002", "0003"}
set {TID, text item delimiters} to {text item delimiters, return & return}
set theResult to theList as text
set text item delimiters to TID
display dialog theResult buttons {"OK"} default button "OK"