History

20060303-partial

Charles.Forsyth committed 19 years ago

Commit eea662d1 parent 828770d2704 files · +339603 −-1453Browse files

Showing the changes to module/string.m (1 of 2704 files). Show all

Unified · Split

module/string.m+39−0
@@ -0,0 +1,39 @@
1String: module
2{
3 PATH: con "/dis/lib/string.dis";
4
5 # the second arg of the following is a character class
6 # e.g., "a-zA-Z", or "^ \t\n"
7 # (ranges indicated by - except in first position;
8 # ^ is first position means "not in" the following class)
9 # splitl splits just before first char in class; (s, "") if no split
10 # splitr splits just after last char in class; ("", s) if no split
11 # drop removes maximal prefix in class
12 # take returns maximal prefix in class
13
14 splitl: fn(s, cl: string): (string, string);
15 splitr: fn(s, cl: string): (string, string);
16 drop: fn(s, cl: string): string;
17 take: fn(s, cl: string): string;
18 in: fn(c: int, cl: string): int;
19
20 # in these, the second string is a string to match, not a class
21 splitstrl: fn(s, t: string): (string, string);
22 splitstrr: fn(s, t: string): (string, string);
23
24 # is first arg a prefix of second?
25 prefix: fn(pre, s: string): int;
26
27 tolower: fn(s: string): string;
28 toupper: fn(s: string): string;
29
30 # string to int returning value, remainder
31 toint: fn(s: string, base: int): (int, string);
32 tobig: fn(s: string, base: int): (big, string);
33
34 # append s to end of l
35 append: fn(s: string, l: list of string): list of string;
36 quoted: fn(argv: list of string): string;
37 quotedc: fn(argv: list of string, cl: string): string;
38 unquoted: fn(args: string): list of string;
39};