DataBasic Reference > Statements and Intrinsic Functions > C > CHECKSUM Function

Comment on this topic

Documentation Comments

Use this form to comment on this topic. You can also provide any general observations about the Online Documentation, or request that additional information be added in a future release.

Reality V15.0 ()

CHECKSUM Function (DataBasic) (m618703+checksum_f.htm)

To

Reality

Version

Topic

Submitted by

Company

Location

Email address

Comment

 

 

CHECKSUM Function

Returns a number equal to the checksum of the specified string.

Syntax

CHECKSUM(expression)

Syntax Elements

expression is any valid DataBasic expression or any string, substring, or value; expressed as a variable name, a value, or a string enclosed in quotes.

Algorithm

The system calculates the checksum by summing the results of multiplying each character value by its position in the string. Thus, the checksum of the string "ABC" would be:

65 * 1 + 66 * 2 + 67 * 3 = 398

Examples

CKSUM = CHECKSUM("123")

Returns the checksum of string 123.

Y = CHECKSUM(X)
PRINT Y

Prints the checksum of string X.

RealityV15.0Comment on this topic