summaryrefslogtreecommitdiff
path: root/bs/string.scm
diff options
context:
space:
mode:
Diffstat (limited to 'bs/string.scm')
-rw-r--r--bs/string.scm10
1 files changed, 5 insertions, 5 deletions
diff --git a/bs/string.scm b/bs/string.scm
index 8839512..9fe794e 100644
--- a/bs/string.scm
+++ b/bs/string.scm
@@ -17,29 +17,29 @@
;; TODO: remove or port ice-9 dependency
(only (ice-9 ports) with-output-to-string))
- ;; Is `pre` a prefix of `s`?
(define (prefix? s pre)
+ "Is PRE a prefix of S?"
(string-prefix? pre s))
- ;; Is `suf` a suffix of `s`?
(define (suffix? s suf)
+ "Is SUF a suffix of S?"
(string-suffix? suf s))
- ;; Split `s` at `sep`
(define (split s sep)
+ "Split S at SEP"
;; this is still wrong. it splits on any of the "sep" characters
;; instead of all of them
(string-tokenize s (char-set-complement (apply char-set (string->list sep)))))
- ;; Replace `match` in `s` with `char`
(define (replace-char s match char)
+ "Replace MATCH in S with CHAR"
(let ((f (lambda (a b)
(let ((next-char (if (eq? a match) char a)))
(string-concatenate (list b (string next-char)))))))
(string-fold f "" s)))
- ;; Replace `match` in `s` with `repl`
(define (replace s match repl)
+ "Replace MATCH in S with REPL"
;; based on string-replace-substring By A. Wingo in
;; https://lists.gnu.org/archive/html/guile-devel/2014-03/msg00058.html
;; also in string-replace-substring guix:guix/utils.scm.