Gambas Documentation
Application Repository
Code Snippets
Compilation & Installation
Components
Controls pictures
Deprecated components
Developer Documentation
Development Environment Documentation
Documents
Error Messages
Gambas Playground
How To's
Language Index
Language Overviews
Arithmetical Functions
Arithmetic Operators
Array Declaration
Assignment Operators
Assignments
Binary Data Representation
Bits Manipulation Functions
Character Test Functions
Comparison methods
Complex numbers
Constant Declaration
Constant Expression
Conversion Functions
Datatype Functions
Datatypes
Date & Time Functions
Enumeration declaration
Error Management
Event Loop
Event Management
Events declaration
Expressions
External Function Management
File & Directory Functions
File & Directory Paths
File mode syntax
Floating Point Numbers
Formatting functions
Gambas Object Model
Global Special Event Handlers
Integer numbers
Intrinsic Functions
Language Constants
Localization and Translation Functions
Local Variable Declaration
Logarithms & Exponentials Functions
Logical Operators
Loop Control Structures
Method Declaration
Miscellaneous Control Structures
Miscellaneous Functions
Native Arrays
Native Container Classes
Object & Class Management
Operator Evaluation Order
Predefined Constants
Process Management
Property Declaration
Random Numbers Functions
Special Methods
Stream & Input/Output functions
String Functions
String Operators
Structure declaration
Test Control Structures & Functions
Trigonometric Functions
User-defined formats
Using reserved keywords as identifiers
Variable Declaration
Last Changes
Lexicon
README
Search the wiki
To Do
Topics
Tutorials
Wiki License
Wiki Manual

Predefined Constants

Datatypes

These constants are returned by TypeOf.

gb.Null NULL value
gb.Boolean Boolean value
gb.Byte Byte value
gb.Short Short value
gb.Integer Integer value
gb.Long Long value
gb.Single Single value
gb.Float Float value
gb.Date Date value
gb.String String value
gb.Variant Variant value
gb.Object Object reference

File types

These constants are used by the Stat() function.

gb.File Regular file
gb.Directory Directory
gb.Device Special file for a device
gb.Pipe Named pipe
gb.Socket Special file for a socket
gb.Link Symbolic link

String constants

gb.NewLine Newline character. Equivalent to Chr$(10).
gb.Cr Carriage return character. Equivalent to Chr$(13). The line terminator on old Macintoshs.
gb.Lf Linefeed character. Equivalent to Chr$(10). The line terminator on Linux and co.
gb.CrLf Carriage return followed by linefeed. The line terminator on Windows and network protocols such as HTTP.
gb.Tab Tab character. Equivalent to Chr$(9).

Sort and comparison

Comparison methods

These constants are used by the comparison, search and sort methods. See Comparison methods for more details.

gb.Binary Binary comparison (This is the default).
gb.IgnoreCase ASCII case insensitive comparison.
gb.Language Comparison according to the current language.
gb.Language + gb.IgnoreCase Case insensitive comparison according to the current language.
gb.Natural Natural comparison according to the current language.
gb.Natural + gb.IgnoreCase Case insensitive natural comparison according to the current language.
gb.Like The second string is assumed to be a LIKE pattern. If the first string matches it, then equality is returned. Otherwise a case insensitive comparison is done.
gb.Match
Since 3.11

The second string is assumed to be a gb.pcre MATCH pattern. If the first string matches it, then equality is returned. Otherwise a case insensitive comparison is done.

Sort order

These constants define the order used by sort methods.

gb.Ascent Ascending sort (this is the default).
gb.Descent Descending sort.

Week days

These constant are the values returned by the WeekDay() function.

gb.Monday Monday
gb.Tuesday Tuesday
gb.Wednesday Wednesday
gb.Thursday Thursday
gb.Friday Friday
gb.Saturday Saturday
gb.Sunday Sunday

Time periods

These constants are the time periods used by the DateAdd and DateDiff functions.

gb.Millisecond Milliseconds.
gb.Second Seconds.
gb.Minute Minutes.
gb.Hour Hours.
gb.Day Days
gb.WeekDay Working days.
gb.Week Weeks.
gb.Month Months.
gb.Quarter Quarters.
gb.Year Years.

Predefined formats

Numeric formats

gb.GeneralNumber Writes a number with twelve decimal digits. Uses scientific format if its absolute value is lower than 10-4 or greater than 107.
gb.Fixed Equivalent to "0.00"
gb.Percent Equivalent to "###%"
gb.Scientific Write a number with its exponent and eighteen decimal digits.

Date and time formats

gb.GeneralDate Write the date and time using the general representation according to the current language.

Writes nothing for a null date, a short time when there is no date, or date and time for all other cases.

Since 3.1

Before Gambas 3.1, it wrote a date only if the date and time value has a date part, and write a time only if it has a date part.

Since 3.16

Before Gambas 3.16, this format was just a concatenation of gb.MediumDate and gb.LongTime.
gb.LongDate Long date format.
gb.MediumDate Medium date format.
gb.ShortDate Short date format.
gb.LongTime Long time format.
gb.MediumTime Medium time format.
gb.ShortTime Short time format.

Currency formats

gb.Currency Formats a currency by using the national currency symbol.
gb.International Formats a currency by using the international currency symbol.

Miscellaneous formats

gb.Standard Use gb.GeneralNumber for formatting numbers and gb.MediumDate eventually followed by gb.LongTime for formatting dates and times.

Endianness

gb.BigEndian Big endianness. The values are stored in memory the higher bytes first.
gb.LittleEndian Little endianness. The values are stored in memory the lower bytes first.