|
From: Todd N. <osx...@ya...> - 2005-02-13 17:51:38
|
-- Sun Feb 13 11:22:35 CST 2005
-- Copyright (c) 2005, Todd Nathan. All Rights
Reserved.
--
-- Generalized Quote, DeQuote and DeWhiting routines.
-- With of course, examples :)
---
to deQuote words, marks, deWhite
get [me parseParams: words, marks, deWhite]
put item 1 of it's marks into om
put item 2 of it's marks into cm
get it's words
repeat until it does not start with om and it does
not start with cm
if it starts with om then delete first length(om)
chars of it
if it ends with cm then delete last length(cm) chars
of it
end repeat
return it
end deQuote
to enQuote words, marks, deWhite
get [me parseParams: words, marks, deWhite]
put item 1 of it's marks into om
put item 2 of it's marks into cm
get it's words
put om before it
put cm after it
return it
end enQuote
to parseParams words, marks, deWhite
put empty object into params
if marks is not EMPTY then
put first item of marks into om --
open mark
put last item of marks into cm --
close mark
else
if universal quotingMarks is not EMPTY
then
put item 1 of universal
quotingMarks into om
put item -1 of universal
quotingMarks into cm
else
put quote into om
put quote into cm
end if
end if
if deWhite is true or deWhite is EMPTY then
get deWhite(words)
else get words
add properties ("marks":om & comma & cm) to params
add properties ("words":it) to params
return params
end parseParams
to deWhite aStr
return words first to last of aStr
end deWhite
on testquotes -- save doc as, or change name of this
handler
get enQuote("Sensetalk Rules")
put it
put deQuote(it)
get enQuote(it)
put it
put deQuote(it)
put ""
get enQuote("Sensetalk Rules", quote)
put it
put deQuote(it)
get enQuote(it)
put it
put deQuote(it)
put ""
get enQuote("Sensetalk Rules", " -x-x- , -x-x- ")
put it
get deWhite(deQuote(it, "-x-x-", true))
put it
put "<<< , >>>" into universal quotingMarks
get enQuote(it)
put it
put deQuote(it)
put ""
end testquotes
__________________________________
Do you Yahoo!?
Yahoo! Mail - You care about security. So do we.
http://promotions.yahoo.com/new_mail
|