Status: useful
Description: strop provides a number of useful string operations, though some bits aren't completely clear. This documentation applies to strop + http://home.thezone.net/~gharvey/guile/strop.diff
index or
rindex function, depending on the value of direction. I'm
not at all clear on the usage of the pos arguments, though the purpose
seems to be correct reporting of which argument values are reporting
errors. Why you would do that, rather than just use SCM_ARG[1234]
explicitly is beyond me. Anyone holding any enlightenment?
#f if the
char isn't in str. If frm is given and not #f,
it is used as the starting index; if to is given and not #f,
it is used as the ending index (exclusive).
(string-index "weiner" #\e) => 1 (string-index "weiner" #\e 2) => 4 (string-index "weiner" #\e 2 4) => #f
string-index, except it gives the rightmost occurance
of char in the range [frm, to-1], which defaults to
the entire string.
(string-rindex "weiner" #\e) => 4 (string-rindex "weiner" #\e 2 4) => #f (string-rindex "weiner" #\e 2 5) => 4
Moves a substring of str1, from start1 to end1 (end1 is exclusive), into str2, starting at start2. Allows overlapping strings.
(define x (make-string 10 #\a)) (define y "bcd") (substring-move-left! x 2 5 y 0) y => "aaa" x => "aaaaaaaaaa" (define y "bcdefg") (substring-move-left! x 2 5 y 0) y => "aaaefg" (define y "abcdefg") (substring-move-left! y 2 5 y 3) y => "abccccg"
Does much the same thing as substring-move-left!, except it
starts moving at the end of the sequence, rather than the beginning.
(define y "abcdefg") (substring-move-right! y 2 5 y 0) y => "ededefg" (define y "abcdefg") (substring-move-right! y 2 5 y 3) y => "abccdeg"
Destructively fills str, from start to end, with fill.
(define y "abcdefg") (substring-fill! y 1 3 #\r) y => "arrdefg"
#t if str is empty, else returns #f
(string-null? "") => #t (string-null? y) => #f
(string-upcase! y) => "ARRDEFG" y => "ARRDEFG"
y => "ARRDEFG" (string-downcase! y) => "arrdefg" y => "arrdefg"