Sorry Detlev, you are right. It is a bug. I actually completely overlook ignoring. I've just noticed it on your second email. And you are right! Actually on page 38 on the new ASLG --"Because text item delimiters respect considering and ignoring attributes in AppleScript 2.0" . So it fails in this case. Funnily: ignoring hyphens set myText to "e-mail" set AppleScript's text item delimiters to "email" log myText = AppleScript's text item delimiters --> true set myText to every text item of myText log myText --> {"e-mail"} instead of {"",""} set text item delimiters to "E-Mail" set myText to myText as text set AppleScript's text item delimiters to "" myText end ignoring -- Result: "e-mail" It is a bug. Deivy
Ah, yes, so I should stop worrying about this. I thought so myself, that this must be a bug. But working on it for the whole afternoon now, I wasn't sure anymore. Maybe I just did not see the wood for the trees.
It must have to do with strings not having the same length or not being combined properly.
Something similar happens with punctuation. You can ignore one punctuation against some other, but you can not omit it.
This does not work: set myText to "a.1" ignoring punctuation set text item delimiters to "a1" set myText to every text item of myText set text item delimiters to "Got it" set myText to myText as text end ignoring -- Ergebnis: "a.1" nothing happend
although direct comparison results in true: ignoring punctuation "a.1" = "a1" -- Result: true end ignoring This is working: set myText to "a.1" ignoring punctuation set text item delimiters to "a!1" set myText to every text item of myText set text item delimiters to "Got it" set myText to myText as text end ignoring -- Ergebnis: "Got it"
Thanks for the confirmation, Deivy!
|