$StrAnd: Difference between revisions
Jump to navigation
Jump to search
m (1 revision) |
(Automatically generated page update) |
||
(27 intermediate revisions by 4 users not shown) | |||
Line 2: | Line 2: | ||
<span class="pageSubtitle">Bit-wise AND two strings</span> | <span class="pageSubtitle">Bit-wise AND two strings</span> | ||
<p class=" | <p class="warn"><b>Note: </b>Many $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $StrAnd function is <var>[[BitAndString (String function)|BitAndString]]</var>.</p> | ||
This function performs a bit-wise AND of two strings. | This function performs a bit-wise AND of two strings. | ||
Line 8: | Line 8: | ||
The <var>$StrAnd</var> function accepts three arguments and returns a string result that is the bit-wise AND 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>$StrAnd</var> function accepts three arguments and returns a string result that is the bit-wise AND 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== | |||
<p class="syntax"><span class="term">%str</span> = <span class="literal">$StrAnd</span>(<span class="term">string1</span>, <span class="term">string2</span>, [<span class="term">pad</span>]) | |||
</p> | |||
The | ===Syntax terms=== | ||
<table> | |||
<tr><th>%str</th> | |||
<td>The bit-wise AND of ''string1'' and ''string2''.</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'010221000000'</code>: | |||
<p class="code">%X = $X2C('112233445566') | |||
%Y = $X2C('654321') | |||
%junk = $StrAnd(%X, %Y) | |||
</p> | </p> | ||
would set % | <li>These statements would set <code>%junk</code> to <code>X'000000444444'</code>: | ||
<p class="code">%X = $X2C('112233445566') | |||
<p class="code"> %X = $X2C('112233445566') | %junk = $StrAnd(%X, , $X2C('CC')) | ||
</p> | </p> | ||
would set % | <li>This code fragment would set <code>%junk</code> to <code>X'112233005500'</code>: | ||
<p class="code">%X = $X2C('112233445566') | |||
<p class="code"> %X = $X2C('112233445566') | %Y = $X2C('1122') | ||
%Z = $X2C('FF00') | |||
%junk = $StrAnd(%X, %Y, %Z) | |||
</p> | </p> | ||
</ol> | |||
==Products authorizing {{PAGENAMEE}}== | |||
<ul class="smallAndTightList"> | |||
<li>[[List of $functions|Sirius functions]]</li> | |||
<li>[[Sirius functions]]</li> | |||
<li>[[Fast/Unload User Language Interface]]</li> | <li>[[Fast/Unload User Language Interface]]</li> | ||
<li>[[Janus Open Client]]</li> | <li>[[Media:JoclrNew.pdf|Janus Open Client]]</li> | ||
<li>[[Janus Open Server]]</li> | <li>[[Media:JosrvrNew.pdf|Janus Open Server]]</li> | ||
<li>[[Janus Sockets]]</li> | <li>[[Janus Sockets]]</li> | ||
<li>[[Janus Web Server]]</li> | <li>[[Janus Web Server]]</li> | ||
<li> | <li>Japanese functions</li> | ||
<li>[[Sir2000 Field Migration Facility]]</li> | <li>[[Media:SirfieldNew.pdf|Sir2000 Field Migration Facility]]</li> | ||
</ul> | </ul> | ||
[[Category:$Functions|$StrAnd]] | [[Category:$Functions|$StrAnd]] |
Latest revision as of 23:28, 20 September 2018
Bit-wise AND two strings
Note: Many $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $StrAnd function is BitAndString.
This function performs a bit-wise AND of two strings.
The $StrAnd function accepts three arguments and returns a string result that is the bit-wise AND 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 = $StrAnd(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'010221000000'
:%X = $X2C('112233445566') %Y = $X2C('654321') %junk = $StrAnd(%X, %Y)
- These statements would set
%junk
toX'000000444444'
:%X = $X2C('112233445566') %junk = $StrAnd(%X, , $X2C('CC'))
- This code fragment would set
%junk
toX'112233005500'
:%X = $X2C('112233445566') %Y = $X2C('1122') %Z = $X2C('FF00') %junk = $StrAnd(%X, %Y, %Z)