MyChat Scripts Engine: IntToHex

MyChat Scripts Engine: IntToHex

"For developers", "Server scripts", "Functions description", "Converting types", "IntToHex".

 

Convert an integer to hexadecimal number as a string.

 

Syntax

function IntToHex(iValue: int64; iDigits: byte): string;

 

Parameters and return values

Parameter

Type

Value

iValue

integer

positive integer that you need to convert to hexadecimal. If you transferred a negative number, the module will be taken from it;

iDigits

byte

final maximum length of the string with leading zeros after conversion.

 

Function result

Text sring that corresponds to the transferred positive integer.

 

Example

begin
  mLogScript(IntToHex(255, 2), '255');
  mLogScript(IntToHex(65535, 2), '65535');
  mLogScript(IntToHex(43981, 2), '43981');
end.

Script work result

[16:55:58] (Log "IntToHex"): [255] FF

[16:55:58] (Log "IntToHex"): [65535] FFFF

[16:55:58] (Log "IntToHex"): [43981] ABCD

[16:55:58] (Run "IntToHex"): Script operation time: 3 ms

[16:55:58] (Run "IntToHex"): Script done successfully.

 

See also

mLogScript