to removeLastCharFromEvey(recordList)
(*This function will strip the last character from every item in recordList.
One demensional lists only please
Returns list where every item has its last character chopped off
*)
set output to `[Unknown macro: {}]`
repeat with each in recordList
set ez to each as string
set newEach to text 1 through -2 of each -- thanks John Delacour for this technique
set end of output to newEach
end repeat
return output
end removeLastCharFromEvey
Comments
I just found an old note... If the trailing character is a return character, instead of using (text 1 thru -2 of n) use (first paragraph of n) -- it's much faster Actually, the original note used the "(characters 1 thru -2 of n) as text" form, which, my testing shows... is significantly slower.
Here are my timings... Loop 100,000 times:
27 sec: (characters 1 thru -2 of n) as text
3 sec: (text 1 thru -2 of n)
3 sec: (first paragraph of n)
So I guess my note isn't all that useful, but at least it's documented -- matt at 12:24:01 07/26/04