Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- CA-Clipper Tools . Books 1-3 - <b>charrelrep()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 CHARRELREP()
 Replaces characters in a string depending on their correlation
------------------------------------------------------------------------------
 Syntax

     CHARRELREP(<cSearchFor1>,<cString1>,<cSearchFor2>,
        <cString2>,<cReplaceExpression>) --> cString

 Arguments

     <cSearchFor1>  Designates one or more characters within <cString1>
     for which to search.

     <cString1>  Designates the character string where <cSearchFor1> is
     found.

     <cSearchFor2>  Designates one or more characters within <cString2>
     for which to search.

     <cString2>  [@]  Designates the character string where <cSearchFor2>
     is found.

     <cReplaceExpression>  Designates one or more characters to replace
     those at the established corresponding position within <cString2>.

 Returns

     The processed <cString2> is returned.

 Description

     This function is easier to use than it seems. If we proceed on the
     assumption that both search expressions and the replacement expression
     are only one character long, then the following steps occur:

     .  All positions are determined where <cSearchFor1> is found
        within <cString1>.

     .  All positions are found where <cSearchFor2> is found within
        <cString2>.

     .  The character in the <cString2> string is replaced by the
        character in the <cReplaceExpression>.

     This function can be used to simplify work with variables that contain
     screen memory.  If cPict1 contains the character "|"at position 34 and
     cPict2 contains the character "-" at the same position, then this
     position within cPict2 can be replaced with a new character, "+"', which
     represents the combination of the two.


     Multiple Exchanges 
     Both search expressions and the replacement expression can be longer
     than one character.  The previously described exchange procedure occurs
     repeatedly -- initially with the first character in the three character
     strings, then with the second, and so on.  The number of iterations is
     regulated by the length of <cSearchFor1>.  If <cSearchFor2> or the
     <cReplaceExpression> are shorter, then the last byte is used again.

 Notes

     .  The length of <cString2> determines the number of search
        procedures at any one time.  The length of <cSearchFor1> determines
        the number of possible exchanges.

     .  The return value of this function can be suppressed by
        implementing CSETREF() to save space in working memory.

     .  A use for multiple replacement using CHARRELREP() can be found
        in the accompanying sample programs.

 Example

     Determine every position where a "b" occurs in the first string and a
     "1" occurs in the second string.  The respective character is then
     exchanged for the one designated as the fifth parameter.

     ? CHARRELREP("b", "b b b b", "1", "bbb11111", "x")
                                                        //"bbb1x1x1"


See Also: CHARRELA() CSETREF() Introduction

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson