bytesum — returns the sum of bytes of the string.

Description:

u8 bytesum(u8 *string);

Returns the the sum of bytes of the string string.

Return values:

Sum of bytes of the string string.

Example:

<item addr=“524:248“ name="Test for bytesum function" type="script">
V-ID/V-ADDR {
        	if(opt0()) {        	
                    	u8 str[] = "12345";
                    	u32 res_1 = bytesum(&str, 2);                    	
                    	u32 res_2 = bytesum(&str, 3);
                    	u32 res_3 = bytesum(&str, 5);                    	
                    	// Result output to the interface
                    	u8 strForMess[150];
                        sprintf(strForMess, "%cSum of first 2 bytes - %d\10Sum of first 3 bytes - %d\10Sum of first 5 bytes - %d", 1, res_1, res_2, res_3);
                    	setStatus(@exciterId():32, &strForMess);
        	}
}
</item>

The result of performing the example in the interface:

Sum of first 2 bytes is 99
Sum of first 3 bytes is 150
Sum of first 5 bytes is 255

Code “1” is 49, code “2” is 50, the sum of the first two bytes is 99, code “3” is 51, the sum of the first three bytes is 150 etc.