(guile.info.gz) String Searching
Info Catalog
(guile.info.gz) String Comparison
(guile.info.gz) Strings
(guile.info.gz) Alphabetic Case Mapping
21.4.8 String Searching
-----------------------
When searching for the index of a character in a string, these
procedures can be used.
-- Scheme Procedure: string-index str chr [frm [to]]
-- C Function: scm_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.
(string-index "weiner" #\e)
=> 1
(string-index "weiner" #\e 2)
=> 4
(string-index "weiner" #\e 2 4)
=> #f
-- Scheme Procedure: string-rindex str chr [frm [to]]
-- C Function: scm_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.
(string-rindex "weiner" #\e)
=> 4
(string-rindex "weiner" #\e 2 4)
=> #f
(string-rindex "weiner" #\e 2 5)
=> 4
Info Catalog
(guile.info.gz) String Comparison
(guile.info.gz) Strings
(guile.info.gz) Alphabetic Case Mapping
automatically generated byinfo2html