有没有办法在AppleScript中实现
Ruby风格的字符串插值?我需要一种灵活的方法来创建字符串模式.
ruby:
fn = "john" => "john" ln = "doe" => "doe" addresses = [] => [] addresses << "#{fn[0]}#{ln}@company.com" => ["jdoe@company.com"] addresses << "#{fn}.#{ln}@company.com" => ["jdoe@company.com","john.doe@company.com"]
AppleScript的:
set fn to "john" set ln to "doe" set theAddresses to {} # jdoe@company.com copy [something here] & "@company.com" to the end of theAddresses
解决方法
AFAIK AppleScript中没有字符串插值.等效的是这样的:
copy first character of fn & ln & "@company.com" to the end of theAddresses copy fn & "." & ln & "@company.com" to the end of theAddresses # {"jdoe@company.com","john.doe@company.com"}