;; -*-theme-d-*-

;; Copyright (C) 2008-2019 Tommi Höynälänmaa
;; Distributed under GNU Lesser General Public License version 3,
;; see file doc/LGPL-3.

(define-interface (standard-library string-utilities)

  (import (standard-library core))

  (declare string-append (:simple-proc ((rest <string>)) <string> pure))

  (declare string (:simple-proc ((rest <character>)) <string> pure))

  (declare string-length (:simple-proc (<string>) <integer> pure))

  (declare string-ref (:simple-proc (<string> <integer>) <character> pure))

  (declare string-empty? (:simple-proc (<string>) <boolean> pure))

  (declare substring
	   (:simple-proc (<string> <integer> <integer>) <string> pure))

  (declare string-last-char (:simple-proc (<string>) <character> pure))

  (declare replace-char (:simple-proc (<string> <character> <character>)
				      <string> pure))

  (declare replace-char-with-string
	   (:simple-proc (<string> <character> <string>)
			 <string> pure))

  (declare split-string (:simple-proc (<string> <character>)
				      (:uniform-list <string>)
				      pure))

  (declare join-strings-with-sep
	   (:simple-proc ((:uniform-list <string>) <string>) <string> pure))

  (declare string-contains-char?
	   (:simple-proc (<string> <character>) <boolean> pure))

  (declare string-char-index
	   (:simple-proc (<string> <character>) <integer> pure))

  (declare string-char-index-right (:simple-proc (<string> <character>)
						 <integer> pure))

  (declare string-take
	   (:simple-proc (<string> <integer>) <string> pure))

  (declare string-drop
	   (:simple-proc (<string> <integer>) <string> pure))

  (declare string-take-right
	   (:simple-proc (<string> <integer>) <string> pure))

  (declare string-drop-right
	   (:simple-proc (<string> <integer>) <string> pure))

  (declare search-substring
	   (:simple-proc (<string> <string>) <integer> pure))

  (declare search-substring-from-end
	   (:simple-proc (<string> <string>) <integer> pure))

  (define <string-match-result> (:maybe (:tuple <string> <integer> <integer>)))

  (declare string-match
	   (:simple-proc (<string> <string>) <string-match-result> pure))

  (declare string-exact-match?
	   (:simple-proc (<string> <string>) <boolean> pure)))
