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/3
use_module
(library(lists),
19
[]).
20
21
string([]).
22
string([
A
|
Cs
])
:-
23
integer
(
A
),
24
A
>
0
,
% no EOF allowed
25
A
<
0
integer,
% UNICODE characters, strictly not yet required.
26
string(
Cs
).
27
28
upcase_string([], []).
29
upcase_string([
C
|
Cs
], [
NC
|
NCs
])
:-
30
code_type(
C
,to_lower(
NC
)),
31
upcase_string(
Cs
,
NCs
).
32
33
downcase_string([], []).
34
downcase_string([
C
|
Cs
], [
NC
|
NCs
])
:-
35
code_type(
C
,to_upper(
NC
)),
36
downcase_string(
Cs
,
NCs
).
37
38
string_length(
S
,
Length
)
:-
39
length
(
S
,
Length
).
40
41
concat_strings(
S1
,
S2
,
New
)
:-
42
append
(
S1
,
S2
,
New
).
43
44
use_module/1
use_module( +Files )
integer/1
integer( T)
append/3
append(? List1,? List2,? List3)
length/2
length(? L,? S)
library
stringutils.yap
Generated by
1.9.3