Caché MultiValue Basic Reference
SADD


Adds two numeric strings.
Synopsis
Arguments
Description
The
SADD function adds two numeric values, expressed as either numbers or as strings, and returns the result. Leading plus signs and leading and trailing zeros are ignored. A string is parsed as a number until a nonnumeric character is encountered. Thus “7dwarves” is parsed as 7. Nonnumeric strings and the null string are parsed as 0.
Arithmetic Operations

To perform arithmetic operations on numeric strings, use the
SADD,
SSUB,
SMUL, and
SDIV functions.

To perform arithmetic operations on floating point numbers, use the
FADD,
FSUB,
FMUL, and
FDIV functions, or use the standard arithmetic operators.

To perform integer division, use the
DIV function. To perform modulo division, use the
MOD function.

To perform arithmetic operations on corresponding elements of dynamic arrays, use the
ADDS,
SUBS,
MULS,
DIVS, and
MODS functions.

To add together the element values within a single dynamic array, use either the
SUM function (for singlelevel dynamic arrays) or the
SUMMATION function (for multilevel dynamic arrays).

To perform numeric comparison operations, use the
SCMP function, or use the standard comparison operators.
Examples
The following examples use the
SADD function to add two numeric strings. All of these examples return 10:
PRINT SADD(7,3)
PRINT SADD("7","3")
PRINT SADD("+7.00","003")
PRINT SADD("7dwarves","3wishes")
All of the following examples return 7:
PRINT SADD(7,0)
PRINT SADD("7","")
PRINT SADD("7","three")
See Also
Copyright © 19972019 InterSystems Corporation, Cambridge, MA