[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

10.7.4 String selection

Function: substring/shared s start &optional end
[SRFI-13] In Gauche, this is the same as substring, except that the end argument is optional.
 
(substring/shared "abcde" 2) => "cde"

Function: string-copy! target tstart s &optional start end
[SRFI-13] Copies a string s into a string target from the position tstart. Optional start and end arguments limits the range of s. If the copied string run over the end of target, an error is signalled.
 
(define s (string-copy "abcde"))
(string-copy! s 2 "ZZ")
s => "abZZe"

Function: string-take s nchars
Function: string-drop s nchars
Function: string-take-right s nchars
Function: string-drop-right s nchars
[SRFI-13] Returns the first nchars-character string of s (string-take) or the string without first nchars (string-drop). The *-right variation counts from the end of string. It is guaranteed that the returned string is always a copy of s, even no character is dropped.
 
(string-take "abcde" 2) => "ab"
(string-drop "abcde" 2) => "cde"

(string-take-right "abcde" 2) => "cde"
(string-drop-right "abcde" 2) => "ab"

Function: string-pad s len &optional char start end
Function: string-pad-right s len &optional char start end
[SRFI-13]

Function: string-trim s &optional char/char-set/pred start end
Function: string-trim-right s &optional char/char-set/pred start end
Function: string-trim-both s &optional char/char-set/pred start end
[SRFI-13]



This document was generated by Ken Dickey on November, 28 2002 using texi2html