Showing the changes to module/string.m (1 of 9462 files). Show all
Unified · Split
| @@ -0,0 +1,40 @@ | ||
| 1 | +String: 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 | + toreal: fn(s: string, base: int): (real, string); | |
| 34 | + | |
| 35 | + # append s to end of l | |
| 36 | + append: fn(s: string, l: list of string): list of string; | |
| 37 | + quoted: fn(argv: list of string): string; | |
| 38 | + quotedc: fn(argv: list of string, cl: string): string; | |
| 39 | + unquoted: fn(args: string): list of string; | |
| 40 | +}; | |