Is there a way to achieve Ruby-style, string interpolation in AppleScript? I need a flexible way of creating string patterns.
Ruby:
fn = "john"
=> "john"
ln = "doe"
=> "doe"
addresses = []
=> []
addresses << "#{fn[0]}#{ln}@company.com"
=> ["[email protected]"]
addresses << "#{fn}.#{ln}@company.com"
=> ["[email protected]", "[email protected]"]
AppleScript:
set fn to "john"
set ln to "doe"
set theAddresses to {}
# [email protected]
copy [something here] & "@company.com" to the end of theAddresses
AFAIK there's no string interpolation in AppleScript. The equivalent would be something like this:
copy first character of fn & ln & "@company.com" to the end of theAddresses
copy fn & "." & ln & "@company.com" to the end of theAddresses
# {"[email protected]", "[email protected]"}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With