ASCIISUM()

calculate the sum of the ASCII values of the characters in a string

Syntax

ASCIISUM (<cString>) --> nAsciiSum

Arguments

<cString> the string to be processed

Returns

<nAsciiSum> sum of the ASCII values in <cString>

Description

The ASCIISUM() function sums up the ASCII values of the characters in <cString>. Be aware that the function is not position sensitive, i.e. a change of position of a certain character in the string does not change the ascii sum.
Examples
      ? asciisum ("ABC")  -->  197
      ? asciisum ("ACB")  -->  197
Tests
      asciisum (replicate ("A", 10000)) == 650000
      asciisum ("0123456789") == 525
      asciisum (nil) == 0
Status

Ready

Compliance

ASCIISUM() is compatible with CT3's ASCIISUM().

Platforms

All

Files

Source is asciisum.c, library is ct3.

See Also