Enfusion Script API
Loading...
Searching...
No Matches
int Interface Reference

Public Member Functions

proto external string AsciiToString ()
 Converts ASCII code to string.
 
proto external string ToString (int len=-1, bool hex=false, string prefix=string.Empty)
 Integer to string with fixed length, padded with zeros.
 
proto external int Sign ()
 Returns an integer that indicates the sign of a number.
 

Static Public Attributes

const int MAX = 2147483647
 
const int MIN = -2147483648
 
const int INVALID_INDEX = -1
 

Member Function Documentation

◆ AsciiToString()

proto external string int.AsciiToString ( )

Converts ASCII code to string.

Returns
string - Converted int.
int ascii_code = 77;
string str = ascii_code.AsciiToString();
Print(str);
>> str = 'M'
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
proto external string AsciiToString()
Converts ASCII code to string.

◆ Sign()

proto external int int.Sign ( )

Returns an integer that indicates the sign of a number.

  • For intNumber.Sign() < 0 result is -1.
  • For intNumber.Sign() == 0 result is 0.
  • For intNumber.Sign() > 0 result is 1.

◆ ToString()

proto external string int.ToString ( int len = -1,
bool hex = false,
string prefix = string.Empty )

Integer to string with fixed length, padded with zeros.

Parameters
lenint Fixed length of output string, number will be padded with '0' from left.
hexbool If true, formats the value as hexadecimal. Otherwise, formats as decimal.
prefixstring Prefixes the hexadecimal output (e.g., "#FF00AA").
int num = 123;
string s1 = num.ToString(5);
string s2 = num.ToString();
string s3 = num.ToString(len: 4, hex: true, prefix: "#");
Print(s1);
Print(s2);
Print(s3);
>> s1 = '00123'
>> s2 = '123'
>> s3 = '#007B'
proto external string ToString(int len=-1, bool hex=false, string prefix=string.Empty)
Integer to string with fixed length, padded with zeros.

Member Data Documentation

◆ INVALID_INDEX

const int int.INVALID_INDEX = -1
static

◆ MAX

const int int.MAX = 2147483647
static

◆ MIN

const int int.MIN = -2147483648
static

The documentation for this interface was generated from the following file: