BitOnString and BitOrString (String functions): Difference between revisions
Jump to navigation
Jump to search
m (Created page with "{{Template:String:BitOrString subtitle}} <var>BitOrString</var> does a logical OR of the bits in two strings. ==Syntax== {{Template:String:BitOrString syntax}} ===Syntax terms...") |
mNo edit summary |
||
Line 19: | Line 19: | ||
==Usage notes== | ==Usage notes== | ||
<ul> | <ul> | ||
<li>Using a null <var class="term">string</var> | <li>Using a null <var class="term">string</var> for <var class="term">orBits</var> is an easy way of ORing each byte in a string with a specific byte value (the <var class="term">pad</var> value). | ||
<li><var>BitOrString</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>BitOrString</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>BitOrString</var> was introduced in <var class="product">[[Sirius Mods|"Sirius Mods"]]</var> version 7.9. | <li><var>BitOrString</var> was introduced in <var class="product">[[Sirius Mods|"Sirius Mods"]]</var> version 7.9. |
Revision as of 03:32, 29 March 2011
Do bitwise Or of strings (String class) [introduced in Sirius Mods 7.9]
BitOrString does a logical OR of the bits in two strings.
Syntax
%result = string:BitOrString( orBits, [Pad= c])
Syntax terms
%result | A string to receive the result of ORing together the bits in string and orBits. |
---|---|
string | One of the strings to be ORed. |
orBits | The other string to be ORed. |
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 for orBits is an easy way of ORing each byte in a string with a specific byte value (the pad value).
- BitOrString is most useful for working with binary data, for example binary data being sent or received with Janus Sockets.
- BitOrString was introduced in "Sirius Mods" version 7.9.
Examples
- The following example converts lower case alphabetic characters to upper case (because EBCDIC A-Z are equal to a-z plus X'40'):
%upper = %lower:bitOrString(, pad='40':x)
In, the above code, if
%lower
were'foobar'
,%upper
would be set to'FOOBAR'
.