YAP 7.1.0
stringutils.yap
Go to the documentation of this file.
1/**
2 * @file stringutils.yap
3 * @author VITOR SANTOS COSTA <vsc@VITORs-MBP.lan>
4 * @date Wed Nov 18 01:14:42 2015
5 *
6 * @brief Simple string utilitiities .
7 *
8 *
9*/
10:- module(string_utils,
11 [string/1,
12 upcase_string/2,
13 downcase_string/2,
14 string_length/2,
15 concat_strings/3
16 ]).
17
18:- append/3use_module(library(lists),
19 []).
20
21string([]).
22string([A|Cs]) :-
23 integer(A),
24 A > 0, % no EOF allowed
25 A < 0integer, % UNICODE characters, strictly not yet required.
26 string(Cs).
27
28upcase_string([], []).
29upcase_string([C|Cs], [NC|NCs]) :-
30 code_type(C,to_lower(NC)),
31 upcase_string(Cs, NCs).
32
33downcase_string([], []).
34downcase_string([C|Cs], [NC|NCs]) :-
35 code_type(C,to_upper(NC)),
36 downcase_string(Cs, NCs).
37
38string_length(S, Length) :-
39 length(S, Length).
40
41concat_strings(S1, S2, New) :-
42 append(S1, S2, New).
43
44
use_module( +Files )
integer( T)
append(? List1,? List2,? List3)
length(? L,? S)