Constant

EPL supports constants to store & express constant value that won’t be changed when the application is running. The data type of constant value can be Number, String, Boolean and DataTime. To define a constant, just click “Insert” -> “Constant” menu. To use a constant value, plus a “#” mark before the constant name in source code. Such as “#Pi” to instead of invariable “3.1415926535”.

The EPL Kernel library and other Internal library provides various constants and constants enumeration, but you can also define your own user-defined constant.

ASCII Code

American Standard Code for Information Interchange (ASCII), a coding scheme using 7 or 8 bits that assigns numeric values to up to 256 characters, including letters, numerals, punctuation marks, control characters, and other symbols.

Call Asc() and Chr() function to convert between ASCII code and the character in EPL

Function Description
Asc Returns the ANSI character code associated with the specified position letter in a string. Returns 0 if the specified position is out the length of the string
Chr Returns the character associated with the specified ANSI character code

 

The following table lists ASCII code from 0 to 127.

Code Char Code Char Code Char Code Char
0 32 [space] 64 @ 96 `
2 33 ! 65 A 97 a
3 34 " 66 B 98 b
4 35 # 67 C 99 c
5 36 $ 68 D 100 d
6 37 % 69 E 101 e
7 38 & 70 F 102 f
8 ** 39 ' 71 G 103 g
9 ** 40 ( 72 H 104 h
10 ** 41 ) 73 I 105 i
11 42 * 74 G 106 j
12 43 + 75 K 107 k
13 ** 44 , 76 L 108 l
0 45 - 77 M 109 m
14 46 . 78 N 110 n
15 47 / 79 O 111 o
16 48 0 80 P 112 p
17 49 1 81 Q 113 q
18 50 2 82 R 114 r
19 51 3 83 S 115 s
20 52 4 84 T 116 t
21 53 5 85 U 117 u
22 54 6 86 V 118 v
23 55 7 87 W 119 w
24 56 8 88 S 120 s
25 57 9 89 Y 121 y
26 58 ; 90 Z 122 z
27 59 ; 91 [ 123 {
28 60 < 92 \ 124 |
29 61 = 93 ] 125 }
30 - 62 > 94 ^ 126 ~
31 63 ? 95 _ 127

Note that, values of 8, 9, 10, and 13 convert to backspace, tab, linefeed, and carriage return characters, respectively. They have no graphical representation, but depending on the application, may affect the visual display of text.

Constant Usage

Color

You can use the kernel library provided color constants to indicate a color related property, such as #Blue, #Green, #Red etc.

All the color related background has a color picker to set, but you can also use RGB() function or color constants to set the color in your code, such as

 

        _MainForm.BackColor = #Blue.

        _MainForm.BackColor = RGB(0,0,255)

 

Line Feed

To let the a string stores multi-lines of text, you can use #NewLine constant to separate the text of different lines, such as to display multi-lines of text in a textbox control, you can code like this

 

        TextBox1.MultiLine = True

        TextBox1.Text = “ The first line.” + #NewLine + “The third line.”

 

Quotation Mark

To contains a left quotation mark or right quotation mark in a string, you can use #LeftQuotationMark and #RightQuotationMark constants. Such as to generate a string that has quotation mark in it like (The “EPL” is easy), you can code like

 

  str = “The ” + #LeftQuotationMark + “EPL” + #RightQuotationMark + “ is easy”

 

Key Code

The Kernel library provides most key code constants of keyboard, all the names of key constants of Kernel library have a “Key” starting, such as “KeyA”, “KeyB”, “Key0”, “KeyF1” etc.

For how to use, see picture below

EPL

Note that, all constants mentioned up is provided by Kernel library.

Constants Enumeration

Constants enumeration is a very useful & convenient constants collection, it stores multi-constants in an object. You can retrieve a constant of constants enumeration by calling #EnumerationName.ItemName type, such as: #VariantType.Boolean, #VariantType.String.

Note that, the constants enumeration only provides by EPL libraries.

User-Defined Constant

To define an user-defined constant, just click “Insert” ->”Constant” menu to activate the application constant table and insert a new constant. The user-defined constant can be only Number, Boolean and String type.

EPL

Insert a new user-defined constant

EPL

A new added constant named “Constan

To use user-defined constant, just same like library provided constant, plus a “#” mark before the constant name in your source code.