BitCountString (String function)

From m204wiki
Revision as of 20:13, 3 September 2015 by ELowell (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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