mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-07-04 03:36:36 +02:00
adding optional third argument to default (non-chibi, non-srfi-23) string-contains
This commit is contained in:
parent
f1a2a8a8e0
commit
046f22a33d
1 changed files with 2 additions and 2 deletions
|
@ -73,10 +73,10 @@
|
||||||
(import (only (srfi 13) string-contains)))
|
(import (only (srfi 13) string-contains)))
|
||||||
(else
|
(else
|
||||||
(begin
|
(begin
|
||||||
(define (string-contains a b)
|
(define (string-contains a b . o) ; really, stupidly slow
|
||||||
(let ((alen (string-length a))
|
(let ((alen (string-length a))
|
||||||
(blen (string-length b)))
|
(blen (string-length b)))
|
||||||
(let lp ((i 0))
|
(let lp ((i (if (pair? o) (car o) 0)))
|
||||||
(and (<= (+ i blen) alen)
|
(and (<= (+ i blen) alen)
|
||||||
(if (string=? b (substring a i (+ i blen)))
|
(if (string=? b (substring a i (+ i blen)))
|
||||||
i
|
i
|
||||||
|
|
Loading…
Add table
Reference in a new issue