-
Notifications
You must be signed in to change notification settings - Fork 0
/
string.sats
55 lines (39 loc) · 1.49 KB
/
string.sats
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
staload "./symintr.sats"
staload "./list.sats"
staload "./maybe.sats"
typedef nat = intGte 0
fun string_explode (string): list (char)
fun string_unexplode (list char): string
// all decimal number
fun string_from_char (char): string
fun string_from_int (int): string
fun string_to_int (string): int
fun string_to_uint (string): int
fun string_to_double (string): double
fun string_to_udouble (string): double
fun string_find (string, string): maybe nat
fun string_contains (string, string): bool
fun string_join (list string, string): string
fun string_split (string, string): list string
fun string_concat (string, string): string
fun string_append (string, char): string
fun string_prepend (string, char): string
fun string_range (string, nat, nat): string // [a,b)
fun string_compare (string, string): int
fun string_eq (string, string): bool
fun string_get (string, nat): char = "mac#"
fun string_len (string): nat
fun string_empty (string): bool
fun string_head (string): char
fun string_tail (string): string
fun string_trim (string): string
fun string_selftest (): void
overload [] with string_get
overload empty with string_empty
overload len with string_len
overload append with string_append
overload prepend with string_prepend
overload concat with string_concat
overload find with string_find
overload head with string_head
overload tail with string_tail