X (String function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
 
(5 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{Template:String:X subtitle}}
{{Template:String:X subtitle}}
<var>X</var> is an [[Intrinsic classes|intrinsic]] function that returns the unencoded value of a hex-encoded string.  It is a compile-time-only equivalent of <var>[[HexToString (String function)|HexToString]]</var>.  Since, in use, it acts like a hex constant, it is also documented with the [[System classes and methods#Constant_methods|"Constant methods"]].


<var>X</var> is an [[Intrinsic classes|intrinsic]] function that returns the unencoded value of a hex-encoded string.  It is a compile-time-only equivalent of <var>[[HexToString (String function)|HexToString]]</var>.  Since, in use, it acts like a hex constant, it is also documented with the [[Constant methods]].
<var>X</var> treats each input character as an input hex digit.
 
The <var>X</var> function treats each input character as an input hex digit.


==Syntax==
==Syntax==
{{Template:String:X syntax}}
{{Template:String:X syntax}}
===Syntax terms===
===Syntax terms===
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>%outString</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>string</th>
<tr><th>string</th>
<td>A hex-encoded string value.</td></tr>
<td>A hex-encoded string value.</td></tr>
Line 16: Line 17:


==Usage notes==
==Usage notes==
<ul><li>As in all <var class="product">Janus SOAP</var> system methods with string outputs, the output <var class="term">%outString</var> variable provides <var>[[Longstrings|longstring]]</var> behavior. However, this adds 28 bytes of VTBL usage to every <var>X</var> constant.
<ul>
<li>Although its utility is dubious, the following is valid and sets %x to <code>x'01'</code>:
<li>As in all <var class="product">[[Janus SOAP]]</var> system methods with string outputs, the output <var class="term">%outString</var> variable provides <var>[[Longstrings|longstring]]</var> behavior. However, this adds 28 bytes of VTBL usage to every <var>X</var> constant.
 
<li>Although its utility is dubious, the following is valid and sets <code>%x</code> to <code>x'01'</code>:
<p class="code">%x = 'f0f1':x:x
<p class="code">%x = 'f0f1':x:x
</p>
</p>
<li><var>X</var> requires a method object <var class="term">%string</var> with an even number of bytes.
 
<li><var>X</var> is available as of <var class="product">Sirius Mods</var> version 7.3.
<li><var>X</var> requires a method object <var class="term">string</var> with an even number of bytes.
 
<li><var>X</var> is available as of <var class="product">[[Sirius Mods|Sirius Mods]]</var> Version 7.3.
</ul>
</ul>


==Example==
==Example==
<ol><li>The following statement would display <code>1234</code>:
The following statement would display <code>1234</code>:
<p class="code">printText {'f1f2f3f4':x}
<p class="code">[[PrintText statement|printText]] {'f1f2f3f4':X}
</p></ol>
</p>


==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}}

Latest revision as of 23:19, 5 November 2012

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".

X 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 %outString 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