I found current read-delimited will return the whole string if delimiter can't be found. It's inconvenient for some cases.
I expect it return #f for this.
And Andy said it maybe because some back compatible reasons. So I decide to add an option to do this job.
If we use the original version, we must do this:
-----------------------------------cut-----------------------------------------------------
(let ((token (call-with-input-string "asdf" (lambda (port) (read-delimited "@" port 'split)))))
(if (eof-object? (cdr token))
""
(car token)))
-----------------------------------end----------------------------------------------------
It's rather ugly.
Now it's better:
-----------------------------------cut-----------------------------------------------------
(call-with-input-string "asdf" (lambda (port) (read-delimited "@" port 'fail))))
==> #f
(call-with-input-string "as@df" (lambda (port) (read-delimited "@" port 'fail))))
==> "as"
-----------------------------------end----------------------------------------------------
If delimiter exists, it works like 'trim mode.
Comments?
Regards.