Skip to content

Instantly share code, notes, and snippets.

@serian
Created May 1, 2010 15:35
Show Gist options
  • Save serian/386424 to your computer and use it in GitHub Desktop.
Save serian/386424 to your computer and use it in GitHub Desktop.
scheme gauche string
;文字列を最初に現れたデリミタ文字で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