changeset 17417:67c6fc2b9f63

doc: Add info about "overlaps" option to strfind, strrep. * libinterp/corefcn/strfind.cc(Fstrfind, Fstrrep). Add note about "overlaps" option.
author Rik <rik@octave.org>
date Mon, 09 Sep 2013 16:26:16 -0700
parents 0bf2fc8562c9
children a1fa416c7c4a
files libinterp/corefcn/strfind.cc
diffstat 1 files changed, 25 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/strfind.cc
+++ b/libinterp/corefcn/strfind.cc
@@ -149,20 +149,29 @@
   "-*- texinfo -*-\n\
 @deftypefn  {Built-in Function} {@var{idx} =} strfind (@var{str}, @var{pattern})\n\
 @deftypefnx {Built-in Function} {@var{idx} =} strfind (@var{cellstr}, @var{pattern})\n\
+@deftypefnx {Built-in Function} {@var{idx} =} strfind (@dots{}, \"overlaps\", @var{val})\n\
 Search for @var{pattern} in the string @var{str} and return the\n\
 starting index of every such occurrence in the vector @var{idx}.\n\
+\n\
 If there is no such occurrence, or if @var{pattern} is longer\n\
 than @var{str}, then @var{idx} is the empty array @code{[]}.\n\
+The optional argument @qcode{\"overlaps\"} determines whether the pattern\n\
+can match at every position in @var{str} (true), or only for unique\n\
+occurrences of the complete pattern (false).  The default is true.\n\
 \n\
 If a cell array of strings @var{cellstr} is specified\n\
-then @var{idx} is a cell array of vectors, as specified\n\
-above.  Examples:\n\
+then @var{idx} is a cell array of vectors, as specified above.\n\
+\n\
+Examples:\n\
 \n\
 @example\n\
 @group\n\
 strfind (\"abababa\", \"aba\")\n\
      @result{} [1, 3, 5]\n\
 \n\
+strfind (\"abababa\", \"aba\", \"overlaps\", false)\n\
+     @result{} [1, 5]\n\
+\n\
 strfind (@{\"abababa\", \"bebebe\", \"ab\"@}, \"aba\")\n\
      @result{}\n\
         @{\n\
@@ -321,10 +330,20 @@
 
 DEFUN (strrep, args, ,
   "-*- texinfo -*-\n\
-@deftypefn  {Built-in Function} {} strrep (@var{s}, @var{ptn}, @var{rep})\n\
-@deftypefnx {Built-in Function} {} strrep (@var{s}, @var{ptn}, @var{rep}, \"overlaps\", @var{o})\n\
-Replace all occurrences of the substring @var{ptn} in the string @var{s}\n\
-with the string @var{rep} and return the result.  For example:\n\
+@deftypefn  {Built-in Function} {@var{newstr} =} strrep (@var{str}, @var{ptn}, @var{rep})\n\
+@deftypefnx {Built-in Function} {@var{newstr} =} strrep (@var{cellstr}, @var{ptn}, @var{rep})\n\
+@deftypefnx {Built-in Function} {@var{newstr} =} strrep (@dots{}, \"overlaps\", @var{val})\n\
+Replace all occurrences of the pattern @var{ptn} in the string @var{str}\n\
+with the string @var{rep} and return the result.\n\
+\n\
+The optional argument @qcode{\"overlaps\"} determines whether the pattern\n\
+can match at every position in @var{str} (true), or only for unique\n\
+occurrences of the complete pattern (false).  The default is true.\n\
+\n\
+@var{s} may also be a cell array of strings, in which case the replacement is\n\
+done for each element and a cell array is returned.\n\
+\n\
+Example:\n\
 \n\
 @example\n\
 @group\n\
@@ -333,8 +352,6 @@
 @end group\n\
 @end example\n\
 \n\
-@var{s} may also be a cell array of strings, in which case the replacement is\n\
-done for each element and a cell array is returned.\n\
 @seealso{regexprep, strfind, findstr}\n\
 @end deftypefn")
 {