diff options
author | Arun Isaac | 2022-07-13 17:57:28 +0530 |
---|---|---|
committer | Arun Isaac | 2022-07-19 17:37:06 +0530 |
commit | f7170b4f5502f5aeb30620a2df4fc5a3049e9a95 (patch) | |
tree | c2911ba8811245155dc63dc3158c40f5734caa46 | |
parent | 4d8f1332d3566b1d2ef3d41fbfd0f0975b058393 (diff) | |
download | tissue-f7170b4f5502f5aeb30620a2df4fc5a3049e9a95.tar.gz tissue-f7170b4f5502f5aeb30620a2df4fc5a3049e9a95.tar.lz tissue-f7170b4f5502f5aeb30620a2df4fc5a3049e9a95.zip |
utils: Add string-contains? utility.
* tissue/utils.scm (string-contains?): New public function.
-rw-r--r-- | tissue/utils.scm | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tissue/utils.scm b/tissue/utils.scm index 26372da..84bafa5 100644 --- a/tissue/utils.scm +++ b/tissue/utils.scm @@ -23,6 +23,7 @@ #:use-module (ice-9 filesystem) #:use-module (ice-9 popen) #:export (string-blank? + string-contains? string-remove-prefix string-remove-suffix human-date-string @@ -36,6 +37,13 @@ "Return #t if STR contains only whitespace. Else, return #f." (string-every char-set:whitespace str)) +(define (string-contains? str1 str2) + "Return #t if STR1 contains STR2. Else, return #f. This is different +from string-contains in that it does not return the index in STR1 +where STR2 occurs as a substring." + (and (string-contains str1 str2) + #t)) + (define (string-remove-prefix prefix str) "Remove PREFIX from STR." (substring str (string-length prefix))) |