94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
-
+
|
(string=? hs ""))
header
(loop (read-line datstr)(append header (list hs))))))
;; get the data up to the next key. if there is no key then return #f
;; return (dat remdat)
(define (formdat:read-dat dat key)
(let ((index (string-search-positions key dat)))
(let ((index (substring-index key dat))) ;; (string-search-positions key dat)))
(if (or (not index)
(null? index)) ;; the key was not found
#f
(let* ((datstr (open-input-string dat))
(result (read-string (caar index) datstr))
(remdat (read-string #f datstr)))
(close-input-port datstr)
|