fronttoken/3, str_toklist/2

fronttoken(String,String,String)
str_toklist(String,TokenList)

Break the string into tokens

Remarks

fronttoken/3 operates as if it were defined by the equation:

String = (the concatenation of Token and RestString)

str_toklist/2 performs one step conversion of the string into a list of tokens

A group of one or more characters constitutes a token in the following cases:

Notice that in DOS-like strings, new lines ('\n') are represented as the couples of the <CR> and the <LF> characters. Contrary, in UNIX -like strings, new lines are represented as the single <LF> character.

Example

fronttoken("all kids do fine",TOK,REST)
TOK=all, REST= kids do fine
1 Solution
fronttoken("all+kids do fine",TOK,REST),
fronttoken(REST,TOK1,_)
TOK=all, REST=+kids do fine, TOK1=+
1 Solution
str_toklist("all kids do fine",L)
L=[all,kids,do,fine]
1 Solution