-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathstrings.t
90 lines (60 loc) · 1.12 KB
/
strings.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
(use runtime test-by-example)
(example-test (runtime '(strings)) #<<.
> (tokens "abc def ghi")
("abc" "def" "ghi")
> (halve "first second third")
("first" " second third")
> (positions digit "abc6d78defg9")
(3 5 6 11)
> (lines "one\ntwo\nthree\n")
("one" "two" "three" "")
> (slices "abc6d78defg9" digit)
("abc" "d" "" "defg" "")
> (urldecode "ab%20cd")
"ab cd"
> (urldecode (urlencode "foobar"))
"foobar"
> (litmatch "<p>" "ab<p>cd" 2)
t
> (endmatch ".arc" "foo.t")
nil
> (endmatch ".arc" "foo.arc")
t
> (posmatch "xy" "abxcyxydef")
5
> (begins "abcdef" "foo")
nil
> (begins "foobar" "foo")
t
> (subst "X" "foo" "abc foo def")
"abc X def"
> (multisubst '(("foo" "X") ("bar" "Y")) "one bar two foo three")
"one Y two X three"
> (findsubseq "foo" "abcfoodef")
3
> (blank "")
t
> (blank " abc ")
nil
> (blank " ")
t
> (nonblank " abc ")
" abc "
> (nonblank " ")
nil
> (trim " abc def ")
"abc def"
> (num 3000.1478)
"3,000.15"
> (pluralize 5 "apple")
"apples"
> (pluralize 1 "apple")
"apple"
> (pluralize '(x) "apple")
"apple"
> (pluralize '(x y z) "apple")
"apples"
> (plural 5 "apple")
"5 apples"
.
)