;;; ps-string: string utilities for Pre-Scheme (define (string-copy! target offset source start end) (do ((tgt offset (+ tgt 1)) (src start (+ src 1))) ((= src end)) (string-set! target tgt (string-ref source src))) (unspecific)) (define (string-append a b) (let* ((len-a (string-length a)) (len-b (string-length b)) (target (make-string (+ len-a len-b)))) (string-copy! target 0 a 0 len-a) (string-copy! target len-a b 0 len-b) target)) (define (string-repeat source n) (let* ((len (string-length source)) (total (* len n)) (target (make-string total))) (do ((ix 0 (+ ix len))) ((= ix total)) (string-copy! target ix source 0 len)) target))