X (String function): Difference between revisions
Jump to navigation
Jump to search
m (X marks the spot (sorry, couldn't resist)) |
m (re-match syntax diagram to revised template; fix tags. Still some link targets that need to be found / written.) |
||
Line 9: | Line 9: | ||
===Syntax terms=== | ===Syntax terms=== | ||
<table class="syntaxTable"> | <table class="syntaxTable"> | ||
<tr><th>% | <tr><th>%outString</th> | ||
<td>A string variable to receive the unencoded value of the method object <var class="term">string</var>.</td></tr> | <td>A string variable to receive the unencoded value of the method object <var class="term">string</var>.</td></tr> | ||
<tr><th | <tr><th>string</th> | ||
<td>A hex-encoded string value.</td></tr> | <td>A hex-encoded string value.</td></tr> | ||
</table> | </table> | ||
Line 26: | Line 26: | ||
==Example== | ==Example== | ||
<ol><li>The following statement would display <code>1234</code>: | <ol><li>The following statement would display <code>1234</code>: | ||
<p class="code"> | <p class="code">printText {'f1f2f3f4':x} | ||
</p></ol> | </p></ol> | ||
==See also== | ==See also== | ||
<ul><li>For details of the <var>printtext</var> statement, please see <var>[[Intrinsic classes#printtext|printText]]</var></ul> | |||
{{Template:String:X footer}} | {{Template:String:X footer}} |
Revision as of 05:28, 2 February 2011
Hex constant method (String class)
X is an intrinsic function that returns the unencoded value of a hex-encoded string. It is a compile-time-only equivalent of HexToString. Since, in use, it acts like a hex constant, it is also documented with the Constant methods.
The X function treats each input character as an input hex digit.
Syntax
%outString = string:X
Syntax terms
%outString | A string variable to receive the unencoded value of the method object string. |
---|---|
string | A hex-encoded string value. |
Usage notes
- As in all Janus SOAP system methods with string outputs, the output %string variable provides longstring behavior. However, this adds 28 bytes of VTBL usage to every X constant.
- Although its utility is dubious, the following is valid and sets %x to
x'01'
:%x = 'f0f1':x:x
- X requires a method object %string with an even number of bytes.
- X is available as of Sirius Mods version 7.3.
Example
- The following statement would display
1234
:printText {'f1f2f3f4':x}
See also
- For details of the printtext statement, please see printText