GNU Info

Info Node: (slib.info)String Search

(slib.info)String Search


Next: Sequence Comparison Prev: Topological Sort Up: Sorting and Searching
Enter node , (file) or (file)node

String Search
-------------

  `(require 'string-search)'

 - Procedure: string-index string char
 - Procedure: string-index-ci string char
     Returns the index of the first occurence of CHAR within STRING, or
     `#f' if the STRING does not contain a character CHAR.

 - Procedure: string-reverse-index string char
 - Procedure: string-reverse-index-ci string char
     Returns the index of the last occurence of CHAR within STRING, or
     `#f' if the STRING does not contain a character CHAR.

 - procedure: substring? pattern string
 - procedure: substring-ci? pattern string
     Searches STRING to see if some substring of STRING is equal to
     PATTERN.  `substring?' returns the index of the first character of
     the first substring of STRING that is equal to PATTERN; or `#f' if
     STRING does not contain PATTERN.

          (substring? "rat" "pirate") =>  2
          (substring? "rat" "outrage") =>  #f
          (substring? "" any-string) =>  0

 - Procedure: find-string-from-port? str in-port max-no-chars
     Looks for a string STR within the first MAX-NO-CHARS chars of the
     input port IN-PORT.

 - Procedure: find-string-from-port? str in-port
     When called with two arguments, the search span is limited by the
     end of the input stream.

 - Procedure: find-string-from-port? str in-port char
     Searches up to the first occurrence of character CHAR in STR.

 - Procedure: find-string-from-port? str in-port proc
     Searches up to the first occurrence of the procedure PROC
     returning non-false when called with a character (from IN-PORT)
     argument.

     When the STR is found, `find-string-from-port?' returns the number
     of characters it has read from the port, and the port is set to
     read the first char after that (that is, after the STR) The
     function returns `#f' when the STR isn't found.

     `find-string-from-port?' reads the port _strictly_ sequentially,
     and does not perform any buffering.  So `find-string-from-port?'
     can be used even if the IN-PORT is open to a pipe or other
     communication channel.

 - Function: string-subst txt old1 new1 ...
     Returns a copy of string TXT with all occurrences of string OLD1
     in TXT replaced with NEW1, OLD2 replaced with NEW2 ....


automatically generated by info2www version 1.2.2.9