push/pop text item delimiters
push/pop text item delimiters
- Subject: push/pop text item delimiters
- From: Steven Majewski <email@hidden>
- Date: Tue, 29 Jun 2004 13:56:57 -0400
Having use the pattern: /save text item delimiters / set TID / restore
TID/
many many times, I was thinking how nice it would be if Apple made one
tiny change and made Applescript's Text Item Delimiters a stack so that
you could just push and pop new delimiters. I was thinking that they
could
provide backwards compatibility pretty cheaply -- AS is full of lots of
little
magic coercions -- just coerce the top of stack to a string.
Well -- it seems that no change is required -- it already works like
that:
set text item delimiters to {""}
display dialog {1, 2, 3} as text
set beginning of text item delimiters to tab -- push tab
display dialog {1, 2, 3} as text
set beginning of text item delimiters to "," -- push comma
display dialog {1, 2, 3} as text
-- 2 pops to get back to initial setting
set text item delimiters to rest of text item delimiters
set text item delimiters to rest of text item delimiters
display dialog {1, 2, 3} as text
( If ONLY push and pop weren't so darn verbose in Applescript! ;-)
-- Steve Majewski
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.