Predefined functions


HBasic provides some predefined functions for different purposes. This document list all this functions and their parameter types.
Contents:
 info_icon Some base-types like Date, Time or File have been dropped from the normal HBasic type list and replaced by a component type. You can find the methods to work with this types in the package description of the matching packages.

See also:  Predefined constants


Handling integer and double numbers

Min
Returns minimum of 2 integer values
Max
Returns maximum of 2 integer values
SQrt
Returns squareroot of a double number
Abs
Returns absolute value of a number
And

Or

Xor

Not



String handling

Len
Returns length of a string
Left
Returns leftmost substring from string
Right
Returns rightmost substring from string
Mid
Return substring of string
Lower
Returns string converted to lowercase letters
Upper
Returns string converted to uppercase letters


Type conversion

Str
Returns a string from an integer or double number
ToLong
Return an integer number from a string
ToDouble
Returns a double number from a string

Trigonometric functions

Sin
Return a double specifying the sine of an angle
Cos
Return a double specifying the cosine of an angle
Tan
Return a double specifying the tangent of an angle
ASin
Return a double specifying the arcsine of an angle
ACos
Return a double specifying the arc cosine of an angle
ATan
Return a double specifying the arc tangent of an angle
Sinh
Return a double specifying the sine hyperbolic of an angle
Cosh
Return a double specifying the cosine hyperbolic of an angle
Tanh
Return a double specifying the tangent hyperbolic of an angle
ASinh
Return a double specifying the arc sine hyperbolic of an angle
ACosh
Return a double specifying the arc cosine hyperbolic of an angle
ATanh
Return a double specifying the arc tangent hyperbolic of an angle


Logarithmic functions

Log
Returns a double specifying the natural logarithm of a number
Log2

Log10

Exp
Returns a Double specifying e (the base of natural logarithm) raised to a power
Exp2
Returns a Double specifying 2 raised to a power
Exp10
Returns a Double specifying 10 raised to a power


Bit manipulation

BSet
Set bit in number at a given position
BClr
Clear bit in number at a given position
BChg
Change bit 0<->1 in number at given position
BTst
Check if bit at position is set (=1)
Bit
Return number with 1 bit set to 1

Date and Time

Day Return current day in month
Month Return current month
Year Return current year
Hour Return hour from current time
Minute Return minute from current time
Second Return second from current time
DayOfWeek Return current day in week as number
DayOfYear Return current day of year
DaysInMonth Return number of days in current month
DaysInYear Return number of days in current year
WeekNumber Return week number for current date
DayName Return name of day
MonthName Return name of month
ShortDayName Return 3 character name of day
ShortMonthName Return 3 character name of month


System information

BufferRam Get memory used by buffers
FreeHigh
Get available high memory size
FreeRam
Get size of free memory
FreeSwap
Get available swap memory size
MemUnit
Get memory unit size
NumProcs
Get number of running processes
Sleep
Let process sleep some time
SharedRam
Get shared ram total size
Sysload1
Get average system load of last minute
Sysload5 Get average system load of last 5 minutes
Sysload15 Get average system load of last 15 minutes
TotalHigh
Get total high memory size
TotalSwap
Get total swap size
TotalRam
Get total ram size
Uptime
Get uptime of computer in seconds


Other functions

MsgBox
Display messagebox in current window
Seed
Set seed for random number generator
Rand
Get random number
System
Start Linux shell command
Load
Load another form
Abort
Abort program with error state
Sleep
Let process sleep some time