X (String function): Difference between revisions
Jump to navigation
Jump to search
m (1 revision) |
m (1 revision) |
||
Line 1: | Line 1: | ||
{{Template:String:X subtitle}} | {{Template:String:X subtitle}} | ||
This [[Intrinsic classes|intrinsic]] function returns the unencoded value of a hex-encoded string. | This [[Intrinsic classes|intrinsic]] function returns the unencoded value of a hex-encoded string. | ||
It is a compile-time-only equivalent of the [[HexToString (String function)|HexToString]] method. | It is a compile-time-only equivalent of the [[HexToString (String function)|HexToString]] method. | ||
Since in use the method acts like a hex constant, it is also | Since in use the method acts like a hex constant, it is also | ||
documented with the [[Constant methods]]. | documented with the [[Constant methods]]. | ||
The X function treats each input character as an input hex digit. | The X function treats each input character as an input hex digit. | ||
The X method is available as of [[Sirius Mods]] version 7.3. | The X method is available as of [[Sirius Mods]] version 7.3. | ||
==Syntax== | ==Syntax== | ||
{{Template:String:X syntax}} | {{Template:String:X syntax}} | ||
Line 18: | Line 18: | ||
<td>A hex-encoded string value.</td></tr> | <td>A hex-encoded string value.</td></tr> | ||
</table> | </table> | ||
==Usage notes== | ==Usage notes== | ||
*As in all '''''Janus SOAP''''' system methods with string outputs, the ''%out'' string variable provides [[Longstrings|longstring]] behavior. This adds 28 bytes of VTBL usage to every X constant, however. | *As in all '''''Janus SOAP''''' system methods with string outputs, the ''%out'' string variable provides [[Longstrings|longstring]] behavior. This adds 28 bytes of VTBL usage to every X constant, however. | ||
*Although its utility is dubious, the following is valid and sets %x to ''''X'01''''': | *Although its utility is dubious, the following is valid and sets %x to ''''X'01''''': | ||
%x = 'f0f1':x:x | %x = 'f0f1':x:x | ||
*The X function requires a method object string with an even number of bytes. | *The X function requires a method object string with an even number of bytes. | ||
===Example=== | ===Example=== | ||
The following statement would display ''''1234'''': | The following statement would display ''''1234'''': | ||
[[Intrinsic classes#printtext|printText]] {'f1f2f3f4':x} | [[Intrinsic classes#printtext|printText]] {'f1f2f3f4':x} | ||
===See also=== | ===See also=== | ||
[[List of intrinsic String methods]] | [[List of intrinsic String methods]] | ||
[[Category:Intrinsic String methods|X function]] | [[Category:Intrinsic String methods|X function]] | ||
[[Category:Intrinsic methods]] | [[Category:Intrinsic methods]] |
Revision as of 14:04, 19 January 2011
Hex constant method (String class)
This intrinsic function returns the unencoded value of a hex-encoded string.
It is a compile-time-only equivalent of the HexToString method.
Since in use the method 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.
The X method is available as of Sirius Mods version 7.3.
Syntax
%outString = string:X
Syntax terms
%out | 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 %out string variable provides longstring behavior. This adds 28 bytes of VTBL usage to every X constant, however.
- Although its utility is dubious, the following is valid and sets %x to 'X'01:
%x = 'f0f1':x:x
- The X function requires a method object string with an even number of bytes.
Example
The following statement would display '1234':
printText {'f1f2f3f4':x}