diff options
-rw-r--r-- | Alpha/Core.scm | 6 | ||||
-rw-r--r-- | Alpha/String.scm | 12 |
2 files changed, 17 insertions, 1 deletions
diff --git a/Alpha/Core.scm b/Alpha/Core.scm index 0ef1098..4ce0bbb 100644 --- a/Alpha/Core.scm +++ b/Alpha/Core.scm @@ -213,3 +213,9 @@ (if (list? x) x (list x))) + +;; is this not in srfi-1? +(define (flatten x) + (cond ((null? x) '()) + ((pair? x) (append (flatten (car x)) (flatten (cdr x)))) + (else (list x)))) diff --git a/Alpha/String.scm b/Alpha/String.scm index 4e32856..6e29663 100644 --- a/Alpha/String.scm +++ b/Alpha/String.scm @@ -1,5 +1,6 @@ (define-module (Alpha String) - #:export (replace replace-char to-string str capitalize split)) + #:export (replace replace-char to-string str capitalize split + strip lstrip rstrip)) (define (split s c) (if s @@ -31,6 +32,15 @@ (str (string-upcase (substring s 0 1)) (substring s 1 ))))) +(define (strip s char) + (string-trim-both s char)) + +(define (lstrip s char) + (string-trim s char)) + +(define (rstrip s char) + (string-trim-right s char )) + ;;; {String Fun: string-replace-substring} ;;; |