triml( +term )

This built-in string predicate removes the leading whitespace characters from the argument string. To remove the leading and trailing whitespaces use trim/1 and to remove trailing whitespaces there is the predicate trimr/1.

see also: &/2 delete/3 expand_sq/1insert/3 is/2 substring/3 string_list/2 to_lower/1 to_string/2 to_upper/1  trim/1 trimr/1 working with strings

Examples
X is_string triml('  abcd   '). variable X is unified with the string 'abcd   '
X is_string triml(' a b f '). variable X is unified with the string 'a b f '

 

Exceptions
The parameter is an empty variable an instantiation_error exception is thrown

 

 

info@trinc-prolog.com