correction addSlashes()

Jan Schenkel janschenkel at yahoo.com
Tue Sep 10 05:36:00 EDT 2002


Hi Sylvain,

Unfortunately, there is no standard function to add
'escape characters' into string -- not one that I
found in the dictionary anyway.
The 'format' function works the other way around
though, so that might be interesting to have a look at
in the Transcript Dictionary.
At any rate, your 'addSlashes' function should work
okay, though I'd be careful with that double quote
transformation.
XTalk uses double quotes, SQL uses single quotes. This
should be an advantage, as you can easily write an
entire SQL statement in one XTalk string.
But sometimes, it gets back at you ;-)

Best regards,

Jan Schenkel.

"As we grow older, we grow both wiser and more foolish
at the same time."  (De Rochefoucald)

--- Sylvain_Le_Gourriérec
<sylvain.legourrierec at son-video.com> wrote:
>
--------------------------------------------------------
> function addSlashes myText
>  
>   -- on remplace \ par \\
>   replace numToChar(92) with numToChar(92) &
> numToChar(92) in myText
>  
>   -- on remplace " par \"
>   replace numToChar(34) with numToChar(92) &
> numToChar(34) in myText
>  
>   -- on remplace ' par \'
>   replace numToChar(39) with numToChar(92) &
> numToChar(39) in myText
>  
>   -- on remplace NULL(ASCII 0) par \0
>   replace numToChar(0) with numToChar(92) &
> numToChar(48) in myText
>  
>  
>   return myText
>  
> end addSlashes
> 
> 
> ------------> better  ;)
> 
> 
> Sylvain Le Gourriérec  --  développement  --
> son-video-distribution
> 
> -------------> windows 2000 + runrev 1.1.1 + MySQL
> 3.23 + PHP 4
> 


__________________________________________________
Yahoo! - We Remember
9-11: A tribute to the more than 3,000 lives lost
http://dir.remember.yahoo.com/tribute



More information about the use-livecode mailing list