|
Type | Description |
String | A string value with a variable number of characters. |
Char | A single character. |
String literals use the single quote (') character to identify themselves as such. Any single quotes enclosed inside of the literal must be escaped by prefacing them with another single quote. In addition, single character constants may be specified using their literal value or by prefacing their ordinal character set position with the pound sign (#) character. To reference a specific character in a string, use the left and right brackets ([]) with the 1-based integer position of the character being referenced.
The unit SysUtils provides many utility functions for String, like:
Type | Description |
Boolean | A logical true/false value. |
The unit SysUtils provides many utility functions for Boolean, like:
Boolean Methods |
---|
![]() |
![]() |
![]() |
![]() |
Unlike many other programming languages, javaScript does not define different types of numbers, like integers, short, long, floating-point etc. JavaScript only supports double. All Pascal number types and enum values are mapped to this.
Exact numeric types are used when you wish to store a numeric value in its exact representation without accumulating rounding errors. Exact numeric literals use the minus (-) as the negative sign character, the plus (+) as the positive sign character, and scientific notation is supported. In addition, hexadecimal literals can be specified by prefacing the hexadecimal value with the dollar sign ($). Represents integer numbers.
Type | Range | Size |
Byte | 0 .. 255 | unsigned 8-bit |
Shortint | -128 .. 127 | signed 8-bit |
SmallInt | -32768 .. 32767 | signed 16-bit |
Word | 0 .. 65535 | unsigned 16-bit |
Integer | -4503599627370496 .. 4503599627370495 | signed 53-bit |
Cardinal | 0 .. 4294967295 | unsigned 32-bit |
Longint | -2147483648 .. 2147483647 | signed 32-bit |
NativeUInt | 0 .. 4503599627370495 | unsigned 52-bit |
NativeInt | -4503599627370496 .. 4503599627370495 | signed 53-bit |
LongWord | 0 .. 4294967295 | unsigned 32-bit |
Int64 | -9223372036854775808 .. 9223372036854775807 | signed 64-bit |
QWord | 0 .. 18446744073709551615 | unsigned 64-bit |
The unit SysUtils provides many utility functions for Integer, like:
JavaScript numbers are always stored as double precision floating point numbers. This format stores numbers in 64 bits, where the number (the fraction) is stored in bits 0 to 51, the exponent in bits 52 to 62, and the sign in bit 63.
Approximate numeric types are used when you wish to store a numeric value in an approximate representation with a floating decimal point. Using approximate numeric types can cause rounding errors due to the fact that certain numbers such as 0.33 cannot be accurately represented using floating-point precision.
Type | Range | Significant digits |
Real | ±2.9×10-39 .. 1.7×1038 | 11-12 |
Single | ±1.5*10-45 .. 3.4*1038 | 7-8 |
Double | 5*10-324 .. 1.7*10308 | 15-16 |
Extended | 1.9*10-4932 .. 1.1*104932 | 19-20 |
Comp | -2*1064 .. +2*1064-1 | 19-20 |
Currency | -922337203685477.5808 .. 922337203685477.5807 | 19-20 |
The unit SysUtils provides many utility functions for Float, like:
Float Methods |
---|
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Type | Description |
DateTime | A date/time value containing the number of milliseconds since midnight on January 1, 1970. |
The unit SysUtils provides many utility functions for DateTime, like:
Type | Description |
JSValue | JSValue stores any pascal base, since you do not have to predefine the structure by hand. |
The unit JS provides many utility functions for JSValue, like:
Pas2JS pascal source code
var number: TFuncOfInt; MyInteger: Integer; MyDouble: Double; MyString: String; MyCharacter: Char; MyBoolean: Boolean; MyJSValue: JSValue; begin MyInteger := 100; // Assign 100 to the Integer variable MyInteger := $64; // Assign 100 as hexadecimal to the Integer variable MyDouble := -100.25; // Assign -100.25 to the Double variable MyDouble := 5E-324 * 1E1; MyString := 'This is a test'; // Assign "This is a test" // to the String variable MyString := #13+#10; // Assign a carriage return and // linefeed to the String variable MyCharacter := MyString[2]; // Assign the second character // from the String variable to // the Char variable MyString := 'Hello'#13#$0A'World'; console.log(MyString); MyBoolean := False; // Assign False to the Boolean variable MyJSValue := $64; console.log( Math.floor(Integer(MyJSValue)) ); MyJSValue := 13.535; console.log( Math.floor(Double(MyJSValue)) ); MyJSValue := True; MyJSValue := MyString[5]; end.
Type |
Integer = LongInt; |
Cardinal = LongWord; |
DWord = LongWord; |
SizeInt = NativeInt; |
SizeUInt = NativeUInt; |
PtrInt = NativeInt; |
PtrUInt = NativeUInt; |
ValSInt = NativeInt; |
ValUInt = NativeUInt; |
ValReal = Double; |
Real = Double; |
Extended = Double; |
Float = Double; |
Int64 = NativeInt unimplemented; |
UInt64 = NativeUInt unimplemented; |
QWord = NativeUInt unimplemented; |
Single = Double unimplemented; |
Comp = NativeInt unimplemented; |
NativeLargeUInt = NativeUInt; |
UnicodeString = String; |
WideString = String; |
WideChar = char; |
TDynArrayIndex = NativeInt; |
TBooleanDynArray = array of Boolean; |
TIntegerDynArray = array of Integer; |
TStringDynArray = array of String; |
TDoubleDynArray = array of Double; |
TJSValueDynArray = array of JSValue; |