Catalogue of functions for use in expressions. Every function listed here has its own topic: type HELP and the function name, or browse the Index.
FUNCTIONS
Strings: LEN ASC CHR$ STR$ VAL LEFT$ RIGHT$ MID$ UCASE$ LCASE$ SPACE$ STRING$ INSTR HEX$ OCT$ BIN$ FORMAT$ INKEY$ KEYDOWN TAB INKEY$ returns Up=128, Down=129, Left=130, Right=131, and F1-F12 as 145-156; see INKEY$. LTRIM$(s$) / RTRIM$(s$) strip leading/trailing spaces. TRIM$(s$ [, mask$ [, where$]]) strips mask$ (default space) from L, R or B (both, default). BASE$(base, number [, length]) formats number in base 2..36, zero-padded to length. FIELD$(s$, n [, delim$ [, quote$]]) returns 1-based field n, splitting on any character in delim$ (default comma); quoted runs ignore delimiters. DATETIME$(epoch | NOW) is “dd-mm-yyyy hh:mm:ss” (UTC). DAY$(date$ | NOW) is the weekday name, date$ is “dd-mm-yyyy”. DIR$(spec$ [, filter$]) returns the next matching entry, or “” at the end. Call DIR$(“”) to continue the current listing; filter$ is DIR, FILE or ALL.
Math: ABS INT FIX CINT SQR/SQRT SIN COS TAN ATN/ATAN ATN2/ATAN2 ACOS ASIN RND SGN EXP LOG PI MAX MIN DEG RAD CHOICE BOUND EVAL MATH() ATN2(y,x) / ATAN2(y,x) return the angle of (x,y) with quadrant.
Graphics: RGB(r,g,b)|RGB(“NAME”) PIXEL(x,y) THEME(name$) MM.HRES MM.VRES MM.HOST.HRES MM.HOST.VRES MM.HPOS MM.VPOS MM.INFO(MODE) THEME(name$) returns an active editor theme colour; see THEME.
Files: EOF(#n) LOF(#n) LOC(#n) CWD$ INPUT$(nbr,#n) Disk: LOC=seek pos LOF=size EOF=pos>=size TCP: LOC=RX waiting LOF=0 EOF=not connected INPUT$(nbr,#n) count first; TCP non-blocking
Other: PLAYING() DATE$ TIME$ TIMER POS CSRLIN POS is the 1-based console column, CSRLIN the 1-based console row. MM.VER MM.DEVICE$ MM.CMDLINE$ MM.RUNTIME$ MM.BATTERY% MM.BRIGHTNESS% (read-only; MM.BRIGHTNESS% is also assignable) MM.ERRNO MM.ERRMSG$ (last trapped error; see ON) STRUCT() SIZEOF|OFFSET|TYPE|FIND JSON$(json$, path$) JSON_STRINGIFY$(var) DATE$= and TIME$= set the clock strings.
OPTION ANGLE DEGREES makes SIN/COS/TAN/ATN use degrees.
Example:
PRINT LEFT$("MMBASIC", 2)
PRINT RGB(255, 0, 0)
PRINT MM.HRES, MM.VRES, MM.HPOS, MM.VPOS
PRINT MM.CMDLINE$
PRINT KEYDOWN(1)
PRINT THEME("TEXT_BG")
Source: docs/help/functions.txt inmmcore. On the computer, typeHELP FUNCTIONS.