BAP Online Manuals : Library Reference : Library by Name : prologtoken
Previous: process_name
Next: put

6.2.97. prologtoken

extracts the first prolog token in front of a string

SYNOPSIS

prologtoken("Hello World",Token,RestString)

SYNTAX

prologtoken(String,Token,RestString) (i,x,x)

ARGUMENTS

string(String) (i) string to be separated
string(Token) (x) first prolog token contained in String
string(RestString) (x) String without its leading white spaces characters and Token

DESCRIPTION

Prologtoken() skips all white space characters (blanks,tabs) and separates from the resulting string the first valid prolog token. The remainder is matched with RestString. A valid prolog token is either a variable, an atom or string, an integer, a character, brackets, dots, etc.

EXAMPLE

readln(Input),		% e.g. enter "3+5", 
"4*6" 
prologtoken(Input,T1,,R1),
prologtoken(R1,Op,T2),
str_int(T1,I1),str_int(T2,I2),
Expr =.. [Op,I1,I2],e Sum is Expr,
write(Sum),nl.

ERRORS

A runtime error occurs if the arguments belong to the wrong domain.

LAYERS

prolog-process, client-server, object

RELATED PREDICATES

frontchar , str_char , frontchar ,

fronttoken , concat , str_len


BAP Online Manuals : Library Reference : Library by Name : prologtoken
Previous: process_name
Next: put