1:- module(md_trim, [
2 trim_left/2, % +Codes, -Result
3 trim_right/2, % +Codes, -Result
4 trim/2 % +Codes, -Result
5]).
18trim_left([Code|Codes], Result):- 19 code_type(Code, space), !, 20 trim_left(Codes, Result). 21 22trim_left(Codes, Codes).
29trim_right(Codes, Result):-
30 reverse(Codes, CodesR),
31 trim_left(CodesR, ResultR),
32 reverse(ResultR, Result).
39trim(Codes, Result):-
40 trim_left(Codes, Tmp1),
41 reverse(Tmp1, Tmp2),
42 trim_left(Tmp2, Tmp3),
43 reverse(Tmp3, Result)
Code list whitespace trimming
Helper module to trim whitespaces from lists of codes. */