aboutsummaryrefslogtreecommitdiff
path: root/module/string.m
diff options
context:
space:
mode:
authorbhgv <bhgv.empire@gmail.com>2018-03-01 16:54:45 +0200
committerbhgv <bhgv.empire@gmail.com>2018-03-01 16:54:45 +0200
commitb786f20bbab5a59046aa78a2c6c2a11536497202 (patch)
tree0851ecdec889eb9b7ba3751cc04d4f0b474e4a9e /module/string.m
inferno-os tree was separated from the inferno-os-android (separated from the Android driver)
Diffstat (limited to 'module/string.m')
-rw-r--r--module/string.m40
1 files changed, 40 insertions, 0 deletions
diff --git a/module/string.m b/module/string.m
new file mode 100644
index 0000000..a505173
--- /dev/null
+++ b/module/string.m
@@ -0,0 +1,40 @@
+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);
+ toreal: fn(s: string, base: int): (real, 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;
+};