Go to the first, previous, next, last section, table of contents.


String Fun

primitive: string-index str chr [frm [to]]
Return the index of the first occurrence of chr in str. The optional integer arguments frm and to limit the search to a portion of the string. This procedure essentially implements the index or strchr functions from the C library.

primitive: string-rindex str chr [frm [to]]
Like string-index, but search from the right of the string rather than from the left. This procedure essentially implements the rindex or strrchr functions from the C library.

primitive: substring-move-right! str1 start1 end1 str2 start2
primitive: substring-move-left! str1 start1 end1 str2 start2
Copy the substring of str1 bounded by start1 and end1 into str2 beginning at position end2. substring-move-right! begins copying from the rightmost character and moves left, and substring-move-left! copies from the leftmost character moving right.

It is useful to have two functions that copy in different directions so that substrings can be copied back and forth within a single string. If you wish to copy text from the left-hand side of a string to the right-hand side of the same string, and the source and destination overlap, you must be careful to copy the rightmost characters of the text first, to avoid clobbering your data. Hence, when str1 and str2 are the same string, you should use substring-move-right! when moving text from left to right, and substring-move-left! otherwise. If str1 and `str2' are different strings, it does not matter which function you use.

primitive: vector-move-right! vec1 start1 end1 vec2 start2
primitive: vector-move-left! vec1 start1 end1 vec2 start2
Vector versions of substring-move-right! and substring-move-left!

primitive: substring-fill! str start end fill-char
Change every character in str between start and end to fill-char.

primitive: string-null? str
Return #t if str's length is nonzero, and #f otherwise.

primitive: string-upcase! str
primitive: string-downcase! str
Upcase or downcase every character in str, respectively.


Go to the first, previous, next, last section, table of contents.