Article View: fj.editor.emacs
Article #655split string
From: Fujii Hironori
Date: Sat, 31 May 2003 00:29
Date: Sat, 31 May 2003 00:29
39 lines
2038 bytes
2038 bytes
่คไบๅฎๆฒใจ็ณใใพใใ
ๆๅญๅใ็ฉบ็ฝใงๅๅฒใใใใฎใงใใใ
็ฉบ็ฝใ "" ใ \ ใงใฏใชใผใใใจในใฑใผใใใงใใๆนๆณใๆขใใฆใใพใใ
ไพใใฐใ(ๆๅญๅใ || ใงๅฒใใง่กจ่จ)
|abc def| โ (|abc| |def|)
|"abc def" gh| โ (|abc def| |gh|)
|abc\\ def gh| โ (|abc def| |gh|)
้ขๆฐ read-from-string ใๅฉ็จใใฆๆธใใใฎใงใใใ
ไปใฎๆนๆณใฏใใใพใใ?
(defun MY-split-quoted-string (string)
(let ((length (length string))
(start 0) lst)
(while (not (= length start))
(let* ((pair (read-from-string string start))
(obj (car pair)))
(setq start (cdr pair))
(setq lst
(cons
(cond ((stringp obj) obj)
((symbolp obj) (symbol-name obj))
(t (format "%S" obj)))
lst))))
(reverse lst)))
(MY-split-quoted-string "abc def")
=> ("abc" "def")
(MY-split-quoted-string "\"abc def\" gh")
=> ("abc def" "gh")
(MY-split-quoted-string "abc\\ def gh")
=> ("abc def" "gh")
Technical Details
Message-ID:
<87fzmwc610.wl@anago2.mas.chi.its.hiroshima-cu.ac.jp>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!newsfeed.media.kyoto-u.ac.jp!news.media.kyoto-u.ac.jp!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: Japanese,JIS X-Google-Thread: ff358,9928b267563d584d,start X-Google-Attributes: gidff358,public X-Google-ArrivalTime: 2003-05-30 17:28:37 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!newsfeed.media.kyoto-u.ac.jp!news.media.kyoto-u.ac.jp!not-for-mail From: Fujii Hironori <fujii@chi.its.hiroshima-cu.ac.jp> Newsgroups: fj.editor.emacs Subject: split string Date: Sat, 31 May 2003 09:29:47 +0900 Organization: Hiroshima City University Graduate School Lines: 40 Message-ID: <87fzmwc610.wl@anago2.mas.chi.its.hiroshima-cu.ac.jp> NNTP-Posting-Host: edus4050.edu.ipc.hiroshima-cu.ac.jp Mime-Version: 1.0 (generated by SEMI 1.14.4 - "Hosorogi") Content-Type: text/plain; charset=ISO-2022-JP X-Trace: caraway.media.kyoto-u.ac.jp 1054340917 1425 165.242.18.50 (31 May 2003 00:28:37 GMT) X-Complaints-To: news@news.media.kyoto-u.ac.jp NNTP-Posting-Date: Sat, 31 May 2003 00:28:37 +0000 (UTC) User-Agent: Wanderlust/2.10.0 Emacs/21.2 Mule/5.0