diff options
Diffstat (limited to 'module/string.m')
| -rw-r--r-- | module/string.m | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/module/string.m b/module/string.m new file mode 100644 index 00000000..41ce5e4e --- /dev/null +++ b/module/string.m @@ -0,0 +1,39 @@ +String: module +{ + PATH: con "/dis/lib/string.dis"; + + # the second arg of the following is a character class + # e.g., "a-zA-Z", or "^ \t\n" + # (ranges indicated by - except in first position; + # ^ is first position means "not in" the following class) + # splitl splits just before first char in class; (s, "") if no split + # splitr splits just after last char in class; ("", s) if no split + # drop removes maximal prefix in class + # take returns maximal prefix in class + + splitl: fn(s, cl: string): (string, string); + splitr: fn(s, cl: string): (string, string); + drop: fn(s, cl: string): string; + take: fn(s, cl: string): string; + in: fn(c: int, cl: string): int; + + # in these, the second string is a string to match, not a class + splitstrl: fn(s, t: string): (string, string); + splitstrr: fn(s, t: string): (string, string); + + # is first arg a prefix of second? + prefix: fn(pre, s: string): int; + + tolower: fn(s: string): string; + toupper: fn(s: string): string; + + # string to int returning value, remainder + toint: fn(s: string, base: int): (int, string); + tobig: fn(s: string, base: int): (big, string); + + # append s to end of l + append: fn(s: string, l: list of string): list of string; + quoted: fn(argv: list of string): string; + quotedc: fn(argv: list of string, cl: string): string; + unquoted: fn(args: string): list of string; +}; |
