$StrXor: Difference between revisions
(Automatically generated page update) |
mNo edit summary |
||
Line 2: | Line 2: | ||
<span class="pageSubtitle">Bit-wise exclusive OR two strings</span> | <span class="pageSubtitle">Bit-wise exclusive OR two strings</span> | ||
<p class="warn"><b>Note: </b>Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $StrXor function is | <p class="warn"><b>Note: </b>Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $StrXor function is <var>[[BitXorString (String function)|BitXorString]]</var>.</p> | ||
This function performs a bit-wise exclusive OR of two strings. | This function performs a bit-wise exclusive OR of two strings. | ||
The <var>$StrXor</var> function accepts three arguments and returns a string result that is the bit-wise exclusive OR of the first two arguments, the shorter being padded with as many copies of the third argument as are required to make the string lengths equal. | The <var>$StrXor</var> function accepts three arguments and returns a string result that is the bit-wise exclusive OR of the first two arguments, the shorter being padded with as many copies of the third argument as are required to make the string lengths equal. | ||
==Syntax== | ==Syntax== | ||
<p class="syntax"><span class="term">%STR</span> = <span class="literal">$StrXor</span>(<span class="term">string1</span>, <span class="term">string2</span>, [<span class="term">pad</span>]) | <p class="syntax"><span class="term">%STR</span> = <span class="literal">$StrXor</span>(<span class="term">string1</span>, <span class="term">string2</span>, [<span class="term">pad</span>]) | ||
</p> | </p> | ||
===Syntax terms=== | |||
<table> | |||
<tr><th>%str</th> | |||
<td>The bit-wise AND of <var class="term">string1</var> and <var class="term">string2</var>.</td></tr> | |||
<tr><th>string1</th> | |||
<td>An arbitrary string.</td></tr> | |||
< | <tr><th>string2</th> | ||
<td>Another arbitrary string.</td></tr> | |||
</ | |||
<tr><th>pad</th> | |||
<td>An arbitrary string that is appended to the shorter of the first two strings and replicated as many times as required to make the strings of equal length. If this value is not specified or is null, it defaults to a single null byte (X'00'). | |||
</td></tr> | |||
</table> | |||
<p class="code"> %X = $X2C('112233445566') | ==Examples== | ||
<ol> | |||
<li>This code fragment would set <code>%junk</code> to <code>X'746112445566'</code>: | |||
<p class="code">%X = $X2C('112233445566') | |||
%Y = $X2C('654321') | |||
%junk = $StrXor(%X, %Y) | |||
</p> | </p> | ||
would set % | <li>These statements would set <code>%junk</code> to <code>X'DDEEFF8899AA'</code>: | ||
<p class="code">%X = $X2C('112233445566') | |||
%junk = $StrXor(%X, , $X2C('CC')) | |||
</p> | |||
<p class="code"> %X = $X2C('112233445566') | <li>This code fragment would set <code>%junk</code> to <code>X'0000CC44AA66'</code>: | ||
<p class="code">%X = $X2C('112233445566') | |||
%Y = $X2C('1122') | |||
%Z = $X2C('FF00') | |||
%junk = $StrXor(%X, %Y, %Z) | |||
</p> | </p> | ||
</ol> | |||
==Products authorizing {{PAGENAMEE}}== | ==Products authorizing {{PAGENAMEE}}== | ||
Line 57: | Line 60: | ||
<li>[[Sir2000 Field Migration Facility]]</li> | <li>[[Sir2000 Field Migration Facility]]</li> | ||
</ul> | </ul> | ||
[[Category:$Functions|$StrXor]] | [[Category:$Functions|$StrXor]] |
Revision as of 21:08, 24 July 2013
Bit-wise exclusive OR two strings
Note: Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $StrXor function is BitXorString.
This function performs a bit-wise exclusive OR of two strings.
The $StrXor function accepts three arguments and returns a string result that is the bit-wise exclusive OR of the first two arguments, the shorter being padded with as many copies of the third argument as are required to make the string lengths equal.
Syntax
%STR = $StrXor(string1, string2, [pad])
Syntax terms
%str | The bit-wise AND of string1 and string2. |
---|---|
string1 | An arbitrary string. |
string2 | Another arbitrary string. |
pad | An arbitrary string that is appended to the shorter of the first two strings and replicated as many times as required to make the strings of equal length. If this value is not specified or is null, it defaults to a single null byte (X'00'). |
Examples
- This code fragment would set
%junk
toX'746112445566'
:%X = $X2C('112233445566') %Y = $X2C('654321') %junk = $StrXor(%X, %Y)
- These statements would set
%junk
toX'DDEEFF8899AA'
:%X = $X2C('112233445566') %junk = $StrXor(%X, , $X2C('CC'))
- This code fragment would set
%junk
toX'0000CC44AA66'
:%X = $X2C('112233445566') %Y = $X2C('1122') %Z = $X2C('FF00') %junk = $StrXor(%X, %Y, %Z)