BitXorString (String function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (Created page with "{{Template:String:BitXorString subtitle}} <var>BitXorString</var> does a logical XOR of the bits in two strings. ==Syntax== {{Template:String:BitXorString syntax}} ===Syntax t...")
 
m (Created page with "{{Template:String:BitXorString subtitle}} <var>BitXorString</var> does a logical XOR of the bits in two strings. ==Syntax== {{Template:String:BitXorString syntax}} ===Syntax t...")
Line 12: Line 12:
<tr><th>xorBits</th>
<tr><th>xorBits</th>
<td>The other string to be XORed.</td></tr>
<td>The other string to be XORed.</td></tr>
<tr><th>Pad</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">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>
</table>
</table>

Revision as of 00:21, 13 April 2011

Do bitwise exclusive Or of strings (String class)

[Introduced in Sirius Mods 7.9]


BitXorString does a logical XOR of the bits in two strings.

Syntax

%result = string:BitXorString( xorBits, [Pad= c])

Syntax terms

%resultA string to receive the result of XORing together the bits in string and xorBits.
string One of the strings to be XORed.
xorBits The other string to be XORed.
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 pad 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 or xorBits is an easy way of XORing each byte in a string with a specific byte value (the pad value).
  • BitXorString is most useful for working with binary data, for example binary data being sent or received with Janus Sockets.
  • BitXorString was introduced in "Sirius Mods" version 7.9.


See also