BitCountString (String function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
No edit summary
 
Line 1: Line 1:
{{Template:String:BitCountString subtitle}}
{{Template:String:BitCountString subtitle}}
This function counts the number of on bits in a string.
This function counts the number of on bits in a string.
==Syntax==
==Syntax==

Latest revision as of 20:13, 3 September 2015

Count number of on bits in a string (String class)

[Introduced in Model 204 7.5]

This function counts the number of on bits in a string.

Syntax

%count = string:BitCountString

Syntax terms

%countSet to the number of bits that were on in the method object string.
string The string in which on bits are to be counted.

Usage notes

  • Since there are 8 bits in every byte of a string, the result of the BitCountString function will always be a number from 0 to the length of the method object string times 8.

Examples

The following example counts the number of on bits in the EBCDIC representation of the string "City of Brotherly Love" and assigns it to a variable:

%homMuchLove = "City of Brotherly Love":bitCountString

See also