Hex Editor
Hex Editor - Binary File Editing Software for Windows

Built-In Functions

HHD Software - Hex Editor Serial Port Monitor USB Protocol Analyzer Network Monitor
 
 
 
< PreviousTopNext >

Hex Editor Neo provides a number of built-in functions, that perform type cast on their parameters:

Function Name Description
bool(exp)

Convert a given parameter exp to a boolean value. The following conversion rules apply:

Value's type Behavior
bool exp returned
int false if exp equals to zero, true otherwise
double false if exp equals to zero, true otherwise
string false if exp is an empty string, true otherwise

Note that when a statement expects a boolean, it converts the passed value to boolean automatically. The same rules are used during this implicit conversion.

int(exp) Convert a given parameter exp to an integer value. Floating-point numbers are truncated to nearest integer, strings are parsed as containing an integer. If parsing error occurs, the result of the conversion is zero. If passed string starts with "0", it is considered as containing octal number. If passed string starts with "0x" or "0X", it is considered as containing hexadecimal number.
double(exp) Convert a given parameter exp to a floating-point value. If used on string, a string is parsed as containing a floating-point number. If parsing error occurs, the result of the conversion is zero.
string(exp) Convert a given parameter exp to a string value.
decimal(exp) Convert a given parameter exp to an integer value. Always treats a passed string as containing decimal number (regardless of any prefixes).
hex(exp) Convert a given parameter exp to an integer value. Always treats a passed string as containing hexadecimal number (regardless of any prefixes).
octal(exp) Convert a given parameter exp to an integer value. Always treats a passed string as containing octal number (regardless of any prefixes).
binary(exp) Convert a given parameter exp to an integer value. Always treats a passed string as containing binary number (regardless of any prefixes).
integer_convert(exp, radix) Convert a given parameter exp to an integer value. An integer's base is passed as second argument to the function. It is automatically converted to integer.
format(fmt_string, ...) This function takes a format string fmt_string and arbitrary number of arguments. It returns a string after placing each passed parameter to corresponding placeholder in a format string.
type(exp)

Determine the type of the expression exp. Returns one of the following values (symbolic names are predefined in stddefs.h):

Symbolic Constant Value Type of Expression
BooleanType 0 bool
IntegerType 1 int
FloatingPointType 2 double
StringType 3 string

Examples

        int(2.5)           // results to 2 (integer)
        int("89")          // results to 89 (integer)
        double("7.8")      // results to 7.8 (floating-point)
        double("string")   // results to 0.0 (floating-point)
      
< PreviousTopNext >
Copyright © 2012 HHD Software. All rights reserved.