frontstr

BAP Online Manuals : Library Reference : Library by Name : frontstr
Previous: frontchar
Next: fronttoken

6.2.62. frontstr

extracts the first n characters from a string

SYNOPSIS

frontstr("Hello World",6,FrontStr,RestString)

SYNTAX

 frontstr(String,Count,FrontStr,RestString) (i,i,x,x)

ARGUMENTS

string(String) (i) string to be separated
integer(Count) (i) the FrontString will consist of Count characters
string(FrontStr) (x) first Count characters of String
string(RestString) (x) String without its first Count characters

DESCRIPTION

This establishes a relation between String, Count, FronStr, and RestString, thus that String = FrontStr+RestString and str_len(FronStr,Count) is true. The String and Count arguments must be initalized.

EXAMPLE

frontstr("Hello World",6,F,R),
concat("Happy ",R,Str),
write(Str),nl.

ERRORS

A runtime error occurs if the arguments belong to the wrong domain. Fails if the relation cannot be established.

LAYERS

prolog-process, client-server, object

RELATED PREDICATES

frontchar , str_char , fronttoken , prologtoken , concat , str_len


BAP Online Manuals : Library Reference : Library by Name : frontstr
Previous: frontchar
Next: fronttoken