escape string

Arye L.
5321

May 30, 2011
4 Posts

0  |  0  

Re: escape string

does ATEast have a funciton for escaping strings?
like
http://www.php.net/manual/en/function.addslashes.php

DrATEasy (Ron Y.)
Mission Viejo, CA

May 31, 2011
367 Posts

0  |  0  

Re: escape string

There is no such function. you can write one easily. I did not tested the code but it should work with slight modifications:

StringToEscapeString(sSrc:Val String) : String
i : Long
sDst:String
{


   For i=0 to len(sSrc)-1
     Select sSrc[i]
     Case “\””
           sDst=sDst+”\\\””
    Case “\r”
           sDst=sDst+\\r
    Case "\n"
       ...

    Case else
          ! check for non printable, may wide this range
          if s[i]<0x20 or s[i]>0x7D
              sDst=SDst+&quot;\\x0&quot;+Format(s[i], &quot;XX&quot;)
          else
              ! printable character
              sDst=sDst+s[i]
          endif
    EndSelect
   Next
   Return sDst

}

Arye L.
5321

Jun 1, 2011
4 Posts

0  |  0  

Re: escape string

thanks I will



Please Note
You need to have a M@GIC account to participate in the Forums.
Not yet registered on our website? Click here to register today!

All content, information and opinions presented on the Marvin Test Solutions User Forums are those of the authors of the posts and messages and not Marvin Test Solutions'. All attachments and files are downloaded at your own risk. [Read More]