Created
October 25, 2015 11:43
-
-
Save nekoTheShadow/7e20e690969708b16d13 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(use srfi-14) | |
(define (string-split string char-set-delimiter) | |
(let loop((str (string->list string)) (unit '()) (result '())) | |
(if (null? str) | |
(reverse (map (lambda (ls) (list->string (reverse ls))) (cons unit result))) | |
(if (char-set-contains? char-set-delimiter (car str)) | |
(loop (cdr str) '() (cons unit result)) | |
(loop (cdr str) (cons (car str) unit) result))))) | |
(write (string-split "1234/abc\nあいう" (string->char-set "/\n"))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment