Previous: srfi strings spec replicate, Up: srfi strings spec [Index]
Return:
(string-append (substring/shared s1 0 start1) (substring/shared s2 start2 end2) (substring/shared s1 end1 (string-length s1)))
That is, the segment of characters in str1 from start1 to
end1 is replaced by the segment of characters in str2 from
start2 to end2. If start1 = end1
, this
simply splices the str2 characters into str1 at the
specified index.
Examples:
(string-replace "The TCL programmer endured daily ridicule." "another miserable perl drone" 4 7 8 22) ⇒ "The miserable perl programmer endured daily ridicule." (string-replace "It's easy to code it up in Scheme." "lots of fun" 5 9) ⇒ "It's lots of fun to code it up in Scheme." (define (string-insert s i t) (string-replace s t i i)) (string-insert "It's easy to code it up in Scheme." 5 "really ") ⇒ "It's really easy to code it up in Scheme."
Split the string str into a list of substrings, where each substring is a maximal non–empty contiguous sequence of characters from the character set token-set.
char-set:graphic
(see SRFI-14 for
more on character sets and char-set:graphic
).
string-tokenize
to operating on the indicated substring of
str.
This function provides a minimal parsing facility for simple
applications. More sophisticated parsers that handle quoting and
backslash effects can easily be constructed using regular–expression
systems; be careful not to use string-tokenize
in contexts where
more serious parsing is needed.
(string-tokenize "Help make programs run, run, RUN!") ⇒ ("Help" "make" "programs" "run," "run," "RUN!")
Filter the string str, retaining only those characters that satisfy/do not satisfy the char/char-set/pred argument. If this argument is a procedure, it is applied to the character as a predicate; if it is a char–set, the character is tested for membership; if it is a character, it is used in an equality test.
If the string is unaltered by the filtering operation, these functions may return either str or a copy of str.
Previous: srfi strings spec replicate, Up: srfi strings spec [Index]