BitOffString (String function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
No edit summary
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Template:String:BitOffString subtitle}}
{{Template:String:BitOffString subtitle}}
<var>BitOffString</var> turns off a set of bits in one string as indicated by another.  
<var>BitOffString</var> turns off a set of bits in one string as indicated by another.  


Line 7: Line 6:
===Syntax terms===
===Syntax terms===
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>%result</th><td>A string to receive the result of turning off the bits in <var class="term">offBits</var> for <var class="term">string</var>.</td></tr>
<tr><th nowrap>%result</th><td>A string to receive the result of turning off the bits in <var class="term">offBits</var> for <var class="term">string</var>.</td></tr>
<tr><th>string</th>
<tr><th>string</th>
<td>The string to turn off bits in.</td></tr>
<td>The string to turn off bits in.</td></tr>
Line 13: Line 12:
<td>The bits to turn off.</td></tr>
<td>The bits to turn off.</td></tr>
<tr><th><var>Pad</var></th>
<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">pad</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">pad</var> is <code>'00':x</code>.</td></tr>
<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>Pad</var> is <code>'00':x</code>.</td></tr>
</table>
</table>


==Usage notes==
==Usage notes==
<ul>
<ul>
<li>Using a null <var class="term">string</var> for <var class="term">offBits</var> is an easy way of turning off a specific set of bits for each byte in a string (the <var class="term">pad</var> value).
<li>Using a null <var class="term">string</var> for <var class="term">offBits</var> is an easy way of turning off a specific set of bits for each byte in a string (the <var>Pad</var> value).
 
<li><var>BitOffString</var> is most useful for working with binary data, for example binary data being sent or received with <var class="product">[[Janus Sockets]]</var>.
<li><var>BitOffString</var> is most useful for working with binary data, for example binary data being sent or received with <var class="product">[[Janus Sockets]]</var>.
<li><var>BitOffString</var> was introduced in <var class="product">[[Sirius Mods|Sirius Mods]]</var> version 7.9.
</ul>
</ul>


==See also==
==See also==
<table>
<tr>
<td>
<ul>
<li><var>[[BitAndString (String function)|BitAndString]]</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>
<ul>
<li><var>[[BitAndString (String function)]]</var>
<li><var>[[BitClearString, BitFlipString, and BitSetString (String functions)|BitClearString, BitFlipString, and BitSetString]]</var>
<li><var>[[BitOnString (String function)]]</var>
<li><var>[[BitValueString (String function)|BitValueString]]</var>
<li><var>[[BitOrString (String function)]]</var>
<li><var>[[BitCountString (String function)|BitCountString]]</var>
<li><var>[[BitXorString (String function)]]</var>
</ul>
</ul>
</td>
[[Category:Bit manipulation methods]]
{{Template:String:BitOffString footer}}
{{Template:String:BitOffString footer}}

Latest revision as of 20:18, 3 September 2015

Clear bits in one string from another (String class)

[Introduced in Sirius Mods 7.9]

BitOffString turns off a set of bits in one string as indicated by another.

Syntax

%result = string:BitOffString( offBits, [Pad= c])

Syntax terms

%resultA string to receive the result of turning off the bits in offBits for string.
string The string to turn off bits in.
offBits The bits to turn off.
Pad A single character that indicates the character with which the shorter of the two input strings is to be extended. As many copies of c 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 Pad is '00':x.

Usage notes

  • Using a null string for offBits is an easy way of turning off a specific set of bits for each byte in a string (the Pad value).
  • BitOffString is most useful for working with binary data, for example binary data being sent or received with Janus Sockets.

See also