HPlogo Command Interpreter Access and Variables Programmer's Guide: Series HP 3000 Computer Systems

Appendix B Evaluator Functions

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

The following table identifies most of the expression evaluator functions. For a list of the latest evaluator functions, refer to the MPE/iX Commands Reference Manual (32650-90003)

Table B-1 Expression Evalua0tor Functions

SymbolFunctionExampleResult
+(numeric)addition4 + 59
+(string)concatenate"abc" + "de"abcde
-(numeric)subtraction12 - 66
-(string)deletion of first occurrence"abc" - "b"ac
*multiplication4 * 520
/integer division79/ 107
2exponentiation (0^0 yields 1)2^38
either " or 'string identifier either "abc" or 'abc'abc
()parentheses (3 + 4) * 214
<less than (Strings are compared character by character, until an inequality exists.)

5 < 6

'abcc' < 'abdc'

'abcd' &> 'abc'

TRUE

TRUE

TRUE

<=less than or equal"abc" <= "abc"TRUE
>greater than"xyz" > "abc"TRUE
>=greater than or equal"abc" >= "abc" TRUE
<>not equal5 <> 6TRUE
=equal"xyz"= "xyz"TRUE
ABS(integer)absolute valueABS(-4)4
ALPHA(string)check if a string is alphabetic

ALPHA('abcd')

ALPHA('ab3d ef')

TRUE

FALSE

ALPHANUM(string)check if a string is only alphabetics and digits

ALPHANUM('abCd')

ALPHANUM('45abd')

ALPHANUM('3d ef')

TRUE

TRUE

FALSE

ANDlogical and7=7 AND 5=5TRUE
BANDbitwise and7 BAND 135
BNOTbitwise notBNOT 5-6
BORbitwise or5 BOR 27
BOUND(varname)variable definition test (Returns TRUE if varname has been defined.)BOUND(HPPATH)TRUE
BXORbitwise exclusive or7 BXOR 52
CHR(integer)ASCII value (integer) ===> characterCHR(65)A
CSLcircular shift left-2 CSL 2-5
CSRcircular shift right-7 CSR 1-4
DWNS(string)shift string to lowercase (Operates on ASCII characters in ranges of 'a' through 'z' and 'A' through 'Z' only.)DWNS('aBC&#dE')abc&#de
FINFO(filename,option)file informationFINFO('x.pub',0)TRUE
HEX(integer)convert to hexadecimal stringHEX(329)$149
INPUT([prompt][,wait])accept user inputINPUT('Enter choice:',20)Enter choice: YReturn "Y"
LEN(string)string lengthLEN("abc")3
LFT(string, # chars)left string extractionLFT('abc',2)ab
LSLlogical shift left7 LSL 114
LSRlogical shift right-7 LSR 12,147,483,644
LTRIM(string[,trimstr])trim left end of string

'X'+LTRIM(' abc')

"X"+LTRIM('...abc', '.')

Xabc

Xabc

MAX(num1[,num2...])find largest of several integersMAX(5,4-3,70,0)70
MIN(num1[,num2...])find smallest of several integersMIN(5,4,-3,70,0)-3
MODmodulo25 MOD 21
NOTlogical notNOT(2>1)FALSE
NUMERIC(string)check is a string is all digits

NUMERIC('12345')

NUMERIC('$a234ef')

TRUE

FALSE

OCTAL(integer)convert to octal stringOCTAL(329)%511
ODD(integer)determine if integer is odd

ODD(233)

ODD(-2)

TRUE

FALSE

ORlogical or5=5 OR 2=3TRUE
ORD(string)ordinalORD('AbcD')65
POS(find str,source str[,n])find Nth occurrence of find str in source str (-N searches from right)

POS('ab','cgabd')

POS('.','file.grp.acct',2)

POS('.','file.grp.acct',-1)

3

9

9

RHT(string, # chars)right string extractionRHT("abc",2)bc
RPT(string,count)repeat a string (-count reverses string)

RPT('aBc',3)

RPT('aBc',-3)

aBcaBcaBc

cBacBacBa

RTRIM(string[,trimstr])trim right end of string

RTRIM('abc ')+'X'

RTRIM('abc...','.')+"X"

abcX

abc X

SETVAR(varname,expr)return result of expr and set varname to resultSETVAR(myvar,2*3+5)sets variable myvar to 11 and returns 11
STR(string,start pos, # chars)general string extractionSTR('abcde',2,3)bcd
TYPEOF(expression)type of variable or expression (0 = invalid, 1 = integer, 2 = string, 3 = Boolean value)TYPEOF(HPPATH)2 (string)
UPS(string)shift string to uppercase (Operates on ASCII characters in range of 'a' through 'z' and 'A' through 'Z'.)UPS('aBc5d')ABC5D
XORlogical exclusive or7=7 XOR 5=5FALSE

 

Feedback to webmaster