[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
CHARADD()
Adds the corresponding ASCII codes of two strings
------------------------------------------------------------------------------
Syntax
CHARADD(<cString1>,<cString2>) --> cString
Arguments
<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>.
Returns
The processed character string is returned.
Description
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.
Notes
. 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.
Examples
. 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
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson