$Lstr C2X: Difference between revisions
m (→Syntax) |
mNo edit summary |
||
Line 4: | Line 4: | ||
<p class="warn"><b>Note: </b>Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $Lstr_C2X function is the <var>[[StringToHex (String function)|StringToHex]]</var> function.</p> | <p class="warn"><b>Note: </b>Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $Lstr_C2X function is the <var>[[StringToHex (String function)|StringToHex]]</var> function.</p> | ||
This function converts a byte string into its hexadecimal encoding. It is identical to [[$C2X]] | This function converts a byte string into its hexadecimal encoding. It is identical to <var>[[$C2X]]</var>, except it is [[Longstrings|longstring]] capable. | ||
The $Lstr_C2X function accepts one argument and returns a string result which is the hexadecimal encoding of that argument. | The <var>$Lstr_C2X</var> function accepts one argument and returns a string result which is the hexadecimal encoding of that argument. | ||
The first argument is a longstring. | The first argument is a longstring. | ||
Line 21: | Line 21: | ||
==Usage notes== | ==Usage notes== | ||
<ul> | <ul> | ||
<li><var>[[$Lstr_X2C]]</var> is the inverse of | <li><var>[[$Lstr_X2C]]</var> is the inverse of <var>$Lstr_C2X</var>. | ||
< | |||
</ul> | </ul> | ||
Line 29: | Line 27: | ||
The following code would print <code>D985844099A494</code>, which is the hexadecimal representation of the EBCDIC characters "Red rum". | The following code would print <code>D985844099A494</code>, which is the hexadecimal representation of the EBCDIC characters "Red rum". | ||
<p class="code"> | <p class="code">Print $Lstr_C2X('Red rum') | ||
</p> | </p> | ||
Revision as of 19:16, 11 September 2013
Convert byte string to hexadecimal
Note: Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $Lstr_C2X function is the StringToHex function.
This function converts a byte string into its hexadecimal encoding. It is identical to $C2X, except it is longstring capable.
The $Lstr_C2X function accepts one argument and returns a string result which is the hexadecimal encoding of that argument.
The first argument is a longstring.
The returned value is the hexadecimal encoding of the argument string.
Syntax
%coded = $Lstr_C2X(string)
%coded is set to the hexadecimal encoding of string
Usage notes
- $Lstr_X2C is the inverse of $Lstr_C2X.
Example
The following code would print D985844099A494
, which is the hexadecimal representation of the EBCDIC characters "Red rum".
Print $Lstr_C2X('Red rum')