BitCountString (String function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
(Automatically generated page update)
 
No edit summary
Line 1: Line 1:
{{Template:String:BitCountString subtitle}}
{{Template:String:BitCountString subtitle}}


This page is [[under construction]].
This function counts the number of on bits in a string.
==Syntax==
==Syntax==
{{Template:String:BitCountString syntax}}
{{Template:String:BitCountString syntax}}
===Syntax terms===
===Syntax terms===
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>%count</th><td>number</td></tr>
<tr><th>%count</th><td>Set to the number of bits that were on in the method object string.</td></tr>
<tr><th>string</th>
<tr><th>string</th>
<td>string</td></tr>
<td>The string in which on bits are to be counted.</td></tr>
</table>
</table>
==Usage notes==
==Usage notes==
<ul>
<li>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.</li>
</ul>
==Examples==
==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:
<p class="code">
%homMuchLove = "City of Brotherly Love":bitCountString
</p>
==See also==
==See also==
<table>
<tr>
<td>
<ul>
<li><var>[[BitAndString (String function)|BitAndString]]</var>
<li><var>[[BitOffString (String function)|BitOffString]]</var>
<li><var>[[BitOnString (String function)|BitOnString]]</var>
<li><var>[[BitOrString (String function)|BitOrString]]</var>
<li><var>[[BitXorString (String function)|BitXorString]]</var>
</ul>
</td>
<td>
<ul>
<li><var>[[BitClearString, BitFlipString, and BitSetString (String functions)|BitClearString, BitFlipString, and BitSetString]]</var>
<li><var>[[BitValueString (String function)|BitValueString]]</var>
</ul>
</td>
</table>
{{Template:String:BitCountString footer}}
{{Template:String:BitCountString footer}}

Revision as of 01:25, 22 March 2013

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