Subject Re: Character ' and applylocate some opinion would be welcome
From Dirk <non@non.com>
Date Thu, 7 Apr 2022 13:44:47 +0200
Newsgroups dbase.getting-started

Op 7/04/2022 om 10:48 schreef Mervyn Bick:
> On 2022/04/06 17:55, Mervyn Bick wrote:
>
>> oRef.applyLocate("name = '\'t veer'")
>>
>> A little example is attached.
>
> Oops.  My mind was really in neutral when I created that example and,
> once again, it proves the old definition of test data i.e the only data
> with which the program will actually work.
>
> As it stands the escape_apostrophe() function will only work where there
> is only one apostrophe in the string.  If there is more than one
> apostrophe an additional escape character will be added to the first
> apostrophe in the string for each apostrophe.  Needless to say, this
> will cause a problem. :-(
>
> Please use this revised version of the function.
>
>     function escape_apostrophe(cString)
>        // Add  \ as an escape charater before '
>        if [']$cString
>         for n = len(cString) to 1 step -1
>              if substr(cString,n,1) = [']
> //               cString = stuff(cString,at(['],cString),0,[\])
>                 cString = stuff(cString,n,0,[\])
>              endif
>           next
>        endif
>        return cString
>
> Mervyn.
>
>
>
>
>
Mervyn
thanks

last night was thinking what happens with more then one '

working fine


Dirk