| xHarbour Reference Documentation > Function Reference |
![]() |
![]() |
![]() |
Sums the ASCII codes of all characters in a string.
ASCIISum( <cString> ) --> nASCIISum
The function returns the sum of the ASCII codes of all characters of <cString>.
| See also: | Asc(), CheckSum() |
| Category: | CT:String manipulation , Character functions |
| Source: | ct\asciisum.c |
| LIB: | xhb.lib |
| DLL: | xhbdll.dll |
// The example demonstrates the return value of AsciiSum().
PROCEDURE Main
LOCAL cString := "ABC"
LOCAL cChar
FOR EACH cChar in cString
? Asc( cChar )
NEXT ** Result:
// 65
// 66
// 67
? AsciiSum( cString ) // result: 198
RETURN
http://www.xHarbour.com