|
|
(4 intermediate revisions by one other user not shown) |
Line 1: |
Line 1: |
| {{Template:String:BitOnString subtitle}}
| | #REDIRECT [[BitOnString and BitOrString (String functions)]] |
| | |
| <var>BitOnString</var> sets bits in one string as indicated by another.
| |
| | |
| ==Syntax==
| |
| {{Template:String:BitOnString syntax}}
| |
| ===Syntax terms===
| |
| <table class="syntaxTable">
| |
| <tr><th>%result</th><td>A string to receive the result of setting the bits in <var class="term">onBits</var> for <var class="term">string</var>.</td></tr>
| |
| <tr><th>string</th>
| |
| <td>The string to set bits in.</td></tr>
| |
| <tr><th>onBits</th>
| |
| <td>The bits to set.</td></tr>
| |
| <tr><th><var>Pad</var></th>
| |
| <td>A single character that indicates the character with which the shorter of the two input strings is to be extended. As many copies of <var class="term">c</var> are used as is required to make the shorter string as long as the longer. If both strings are of equal length, no padding is required. The default value of <var class="term">c</var> is <code>'00':x</code>.</td></tr>
| |
| </table>
| |
| | |
| ==Usage notes==
| |
| <ul>
| |
| <li>Using a null <var class="term">string</var> for <var class="term">onBits</var> is an easy way of turning on a specific set of bits for each byte in a string (the <var class="term">pad</var> value).
| |
| <li><var>BitOnString</var> is most useful for working with binary data, for example binary data being sent or received with <var class="product">[[Janus Sockets]]</var>.
| |
| </ul>
| |
| | |
| ==See also==
| |
| <ul>
| |
| <li><var>[[BitAndString (String function)|BitAndString]]</var>
| |
| <li><var>[[BitOffString (String function)|BitOffString]]</var>
| |
| <li><var>[[BitOrString (String function)|BitOrString]]</var>
| |
| <li><var>[[BitXorString (String function)|BitXorString]]</var>
| |
| </ul>
| |
| {{Template:String:BitOnString footer}}
| |