$D2X: Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
(Automatically generated page update)
 
(19 intermediate revisions by 3 users not shown)
Line 2: Line 2:
<span class="pageSubtitle">Hex representation of integer</span>
<span class="pageSubtitle">Hex representation of integer</span>


<p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $D2X function is the [[IntegerToHex (Float function)]].  For a full list of string and numeric conversion functions see [[List of String methods]] and [[List of Float methods]].</p>
<p class="warn"><b>Note: </b>Many $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $D2X function is <var>[[IntegerToHex (Float function)|IntegerToHex]]</var>.  For a full list of string and numeric conversion functions see [[List of String methods]] and [[List of Float methods]].</p>


The $D2X function returns a string which is the hexadecimal equivalent of an integer.  
The $D2X function returns a string which is the hexadecimal equivalent of an integer.  
Line 12: Line 12:
The second argument is the number of output characters in the string. If it is omitted, the output is 8 characters. If, after conversion to an integer, it is 0 or less, or can't be represented as a 31 bit value, the null string is the result. If it is greater than 8, then the output is 8 characters. If it is less than 8, then the leftmost digits of the hexadecimal equivalent are dropped.
The second argument is the number of output characters in the string. If it is omitted, the output is 8 characters. If, after conversion to an integer, it is 0 or less, or can't be represented as a 31 bit value, the null string is the result. If it is greater than 8, then the output is 8 characters. If it is less than 8, then the leftmost digits of the hexadecimal equivalent are dropped.
==Syntax==
==Syntax==
<p class="syntax"><section begin="syntax" />%result = $D2X(int_val, width)
<p class="syntax"><span class="term">%result</span> = $D2X(int_val, width)
<section end="syntax" /></p>
</p>
<p>
<p>
</p>
</p>
<p>%result is set to the width-char hexadecimal representation of int_val.</p>
<p><var class="term">%result</var> is set to the width-char hexadecimal representation of int_val.</p>


The following program will print the value <tt>0C1</tt>:
The following program will print the value <tt>0C1</tt>:


<p class="code"> B
<p class="code">B
PRINT $D2X(193, 3)
PRINT $D2X(193, 3)
END
END
</p>
</p>


<h2>Products authorizing {{PAGENAMEE}}</h2><ul class="smallAndTightList">
==Products authorizing {{PAGENAMEE}}==
<li>[[Sirius functions]]</li>
<ul class="smallAndTightList">
<li>[[List of $functions|Sirius Functions]]</li>
<li>[[Fast/Unload User Language Interface]]</li>
<li>[[Fast/Unload User Language Interface]]</li>
<li>[[Janus Open Client]]</li>
<li>[[Media:JoclrNew.pdf|Janus Open Client]]</li>
<li>[[Janus Open Server]]</li>
<li>[[Media:JosrvrNew.pdf|Janus Open Server]]</li>
<li>[[Janus Sockets]]</li>
<li>[[Janus Sockets]]</li>
<li>[[Janus Web Server]]</li>
<li>[[Janus Web Server]]</li>
<li>[[Japanese functions]]</li>
<li>Japanese functions</li>
<li>[[Sir2000 Field Migration Facility]]</li>
<li>[[Media:SirfieldNew.pdf|Sir2000 Field Migration Facility]]</li>


</ul>
</ul>

Latest revision as of 22:51, 20 September 2018

Hex representation of integer

Note: Many $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $D2X function is IntegerToHex. For a full list of string and numeric conversion functions see List of String methods and List of Float methods.

The $D2X function returns a string which is the hexadecimal equivalent of an integer.

$D2X accepts two optional arguments and returns a string value.

The first argument is the integer to be converted to hexadecimal. If it is omitted, or if after conversion to an integer it can't be represented as a 32 bit 2's complement value, the null string is the result.

The second argument is the number of output characters in the string. If it is omitted, the output is 8 characters. If, after conversion to an integer, it is 0 or less, or can't be represented as a 31 bit value, the null string is the result. If it is greater than 8, then the output is 8 characters. If it is less than 8, then the leftmost digits of the hexadecimal equivalent are dropped.

Syntax

%result = $D2X(int_val, width)

%result is set to the width-char hexadecimal representation of int_val.

The following program will print the value 0C1:

B PRINT $D2X(193, 3) END

Products authorizing $D2X

Products authorizing $D2X