Created
May 1, 2010 15:35
-
-
Save serian/386424 to your computer and use it in GitHub Desktop.
scheme gauche string
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
;文字列を最初に現れたデリミタ文字で2分割したリストを返す | |
;両端の空白は切り捨てられる。 | |
;in | |
;str:文字列 | |
;deli:文字(not文字列) | |
;ret:list | |
(use srfi-13) | |
(define (string-split2 str deli) | |
(let ((pos (string-index str deli))) | |
(list (string-trim-both (substring str 0 pos)) | |
(string-trim-both (substring str (+ pos 1) (string-length str)))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment