common code patterns
Richard Gaskin
ambassador at fourthworld.com
Sat Aug 12 16:20:10 EDT 2017
Dan Friedman wrote:
> Here’s my silly contribution. How many times do we write something
> like this:
>
> put “Are you sure you want to delete the image” && quote & myImageName
> & quote && “?” into tPrompt
>
> I have a simple q() function in all my projects:
>
> function q inData
> return (quote & inData & quote)
> end q
>
> Now, I can simply do this:
>
> put “Are you sure you want to delete the image” && q(myImageName) &
> “?” into tPrompt
>
> Tiny, but mighty. :)
The q function is handy, but handier still would be to have JavaScript's
support for interchangeable single- and double-quotes to allow nesting,
e.g.:
put 'Hello there, Teddy "Roughrider" Roosevelt!'
--
Richard Gaskin
Fourth World Systems
Software Design and Development for the Desktop, Mobile, and the Web
____________________________________________________________________
Ambassador at FourthWorld.com http://www.FourthWorld.com
More information about the use-livecode
mailing list