Expressions

An expression is:

Integer numbers are long integers, floating point numbers are doubles.

All methods and functions accept expressions as their parameters - the number expected is specified in the definition you will find in this manual. The only exception to this rule is represented by:

PUB(id) 

require a variable name as its only parameter

and by the functions which require a function name as their parameter (e.g. SORTUDF).

It is possible to nest a function within a function, as in this example:

SET P = LEFT(RTRIM(LTRIM(S, " "), " "), INC(MUL(R, 2))) 

Proteus determines the type of the variable according to the function being applied; strings and numbers are managed in the same way.

The numeric value of a string is determined by using this rule:

A few examples:

Method:

Result

CONSOLELN 1.23
1.23
CONSOLELN "1.23"
1.23
CONSOLELN 123
123
CONSOLELN "123"
123
CONSOLELN -123
-123
CONSOLELN "-123"
-123
CONSOLELN 0XFF
255
CONSOLELN "0XFF"
0XFF
CONSOLELN 070
56
CONSOLELN "070"
070
CONSOLELN INC(LTRIM("070", "0"))
71
CONSOLELN INC("070")
57
CONSOLELN INC(070)
57 

Every string can include C-like constants, to specify control characters.
The following escape sequences are supported:

\a \b \f \n \r \t \v \\ \? \' \" 

and the octal, hexadecimal and decimal constants specified in this way:

By using one of the last three notations it is possible to specify every character between 0 and 255; in every case, if a constant out of the range is specified, the last digit will be discarded and considered as a character by itself.

e.g. \d512 will be interpreted as [51] [50] (the brackets are to be read as 'character corresponding to'; 50 is the ASCII code of the character '2')

At the same time, take care not to create a constant within the range by chaining a constant and a literal value.

Proteus can deal with strings including NULL characters (Ascii 0), but many functions stop interpreting the string at the first NULL; these are:

functions on dates:
ADDDATE(s, n)
ADDMONTH(s, n)
BOM(s)
CDOW(s)
CMONTH(s)
CONVDATE(s, n1, n2)
DAY(s)
DCONVDATE(s, n)
DIFFDATE(s1, s2)
DOW(s)
DOY(s)
EOM(s)
FULLDATE(s)
ISDATE(s)
ISLEAP(s)
MONTH(s)
NEXTDAY(s, n)
PREVDAY(s, n)
SHRINKDATE(s)
WOM(s)
WOY(s)
YEAR(s) 
functions to justify and format text:
CENTER(s, n)
JUSTIFY(s, n)
PFORMAT(s1, s2)
DETAB(s, n)
ENTAB(s, n)
functions on environment variables:
GETENV(s)
PUTENV(s1, s2) 
functions for match:
MATCH(s1, s2)
IMATCH(s1, s2)
REXMATCH(s1, s2)
REXIMATCH(s1, s2)
REXSTRTRAN(s1, exp, s3)
REXISTRTRAN(s1, exp, s3)
REXFSTRTRAN(s1, exp, func)
REXIFSTRTRAN(s1, exp, func)
REXTOKNEW(s1, exp)
REXITOKNEW(s1, exp)
REXTOKEN(s1, n, exp)
REXITOKEN(s1, n, exp)
REXPOSTOKEN(s1, n, exp)
REXIPOSTOKEN(s1, n, exp)
REXNUMTOKEN(s1, exp)
REXINUMTOKEN(s1, exp)
VECREXSPLIT(s, exp)
VECREXISPLIT(s, exp)
VECREXMATCH(s, exp)
VECREXIMATCH(s, exp)
a few functions on file and system functions:
DIRGET(s)
DIRMAKE(s)
DIROPEN(s, n)
DIRREMOVE(s)
DIRSET(s)
FATTRIB(s)
CHMOD(s, f)
LINK(s1, s2)
FCOPY(s1, s2)
FINSERT(s)
FOPEN(s, n)
FREMOVE(s)
FRENAME(s1, s2)
FRESET(s)
ISFILE(s)
MKTEMP(s)
S2BIN(s)
SYSTEM(s)
CAPTURE(s1, s2, s3, s4)
EXEC(s)
UMASK(s)
ISTIME(s)
TIMETOSEC(s)

Many Windows™-specific functions consider only NULL terminated strings, like their system counterparts, while all other functions operate correctly on strings including NULLs; these are, for example, the routines for extracting tokens and substrings, for joining strings, etc.

Start of page Next topic Previous topic Contents Index
Midnight Lake iPhone Case Black Women Shoes Black Flat Shoes Leather Flats Black Patent Ballerinas Black Ballet Shoes Casual Shoes Black Shoes Women Balle Record Player Cufflinks Best iPhone XR Clear Cases iPhone XS/XS Max Leather Cases Sale Best iPhone 8/8 Plus Silicone Cases iPhone 7/7 Plus Cases & Screen Protector New Cases For iPhone 6/6 Plus iPhone 8 Case Sale iPhone Xr Case Online iPhone 7 Case UK Online iPhone X Case UK Sale iPhone X Case Deals iPhone Xs Case New Case For iPhone Xr UK Online Case For iPhone 8 UK Outlet Fashion Silver Cufflinks For Men Best Mens Cufflinks Outlet Online The Gold Cufflinks Shop Online Cheap Shirt Cufflinks On Sale Nice Wedding Cufflinks UK Online Top Black Cufflinks UK Online Mens Cufflinks Online Silver Cufflinks For Men Men Cufflinks UK Sale Gold Cufflinks UK Online Gold Cufflinks UK Silver Cufflinks UK Shirt Cufflinks Discount Online Mens Cufflinks Deals & Sales Girls Shoes For Dance Fashion Ballet Dance Shoes Best Ballet Flats Shoes UK Online Cheap Ballet Pointe Shoes UK Online Best Ballet Shoes Outlet Best Dance Shoes Sale Cheap Ballet Flats Sale UK Best Pointe Shoes Online UK Ballet Dance Shoes UK Shoes For Dance UK Best Ballet Slippers Shop Best Yoga Shoes Hotsell