+ <function name="DIGIT_SUM" language="en_US">
+ <since>
+ <version>23.1.0</version>
+ <version>22.7.0</version>
+ <version>20.17.0</version>
+ </since>
+ <synopsis>
+ Returns the sum of all the digits in a number.
+ </synopsis>
+ <syntax>
+ <parameter name="num" />
+ </syntax>
+ <description>
+ <para>Returns the numeric sum of all the individual digits in a number, summed up.</para>
+ <para>This can be useful for computing checksums based on the number,
+ where errors are typically digits being off by one.</para>
+ <example title="Get the sum of digits in 859">
+ same => n,Set(digitsum=${DIGIT_SUM(859)}) ; assigns digitsum=22
+ same => n,Set(checksum=$[${digitsum} % 10]) ; assigns checksum=2
+ </example>
+ </description>
+ </function>