Adds the corresponding ASCII codes of two strings


     CHARADD(<cString1>,<cString2>) --> cString


     <cString1>  [@]  Designates the character string to which values
     from a second character string <cString2> are added.

     <cString2>  Designates the character string that is added, character
     for character, to <cString1>.


     The processed character string is returned.


     You can use CHARADD() to produce simple character string coding.  The
     function can prove very useful when processes are coded by individual
     characters in a string.


     .  When both character strings are the same length, then the
        first byte of <cString1> can be linked with the first byte of
        <cString2>, and the second byte of <cString1> can be linked with the
        second byte of <cString2>, and so on.  If <cString2> is shorter than
        <cString1>, then as soon as the last byte of <cString2> is reached,
        the process continues and starts again with the first byte of
        <cString2>.  However, if <cString1> is shorter than <cString2>, the
        process terminates with the end of <cString1>.

     .  Values greater than 256 can result when adding values.  The
        new value is then formed based on the following formula:

           (ASC(Character1) + ASC(Character2))% 256.

     .  Implementing CSETREF() can suppress the return value for this
        function to save room in working memory.


     .  Add a value of 1 to each character:

        ? CHARADD("01234", CHR(1))        // "12345"

     .  Adding a value of 255 to each character corresponds to
        subtracting 1:

        ? CHARADD("12345", CHR(255))      // "01234"

See Also: ADDASCII() CSETREF() Introduction

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.