comparison scripts/strings/substr.m @ 3361:4f40efa995c1

[project @ 1999-11-19 21:19:37 by jwe]
author jwe
date Fri, 19 Nov 1999 21:19:44 +0000
parents c9f70d39255f
children f8dde1807dee
comparison
equal deleted inserted replaced
3360:48bd8127e19b 3361:4f40efa995c1
15 ## You should have received a copy of the GNU General Public License 15 ## You should have received a copy of the GNU General Public License
16 ## along with Octave; see the file COPYING. If not, write to the Free 16 ## along with Octave; see the file COPYING. If not, write to the Free
17 ## Software Foundation, 59 Temple Place - Suite 330, Boston, MA 17 ## Software Foundation, 59 Temple Place - Suite 330, Boston, MA
18 ## 02111-1307, USA. 18 ## 02111-1307, USA.
19 19
20 ## usage: substr (s, offset, len) 20 ## -*- texinfo -*-
21 ## 21 ## @deftypefn {Function File} {} substr (@var{s}, @var{beg}, @var{len})
22 ## Returns the substring of S of length LEN starting at index OFFSET. 22 ## Return the substring of @var{s} which starts at character number
23 ## @var{beg} and is @var{len} characters long.
24 ##
23 ## If OFFSET is negative, extraction starts that far from the end of 25 ## If OFFSET is negative, extraction starts that far from the end of
24 ## the string. If LEN is omitted, the substring extends to the end 26 ## the string. If LEN is omitted, the substring extends to the end
25 ## of S. 27 ## of S.
28 ##
29 ## For example,
30 ##
31 ## @example
32 ## substr ("This is a test string", 6, 9)
33 ## @result{} "is a test"
34 ## @end example
35 ##
36 ## @quotation
37 ## @strong{Note:}
38 ## This function is patterned after AWK. You can get the same result by
39 ## @code{@var{s} (@var{beg} : (@var{beg} + @var{len} - 1))}.
40 ## @end quotation
41 ## @end deftypefn
26 42
27 ## Author: Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at> 43 ## Author: Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at>
28 ## Adapted-By: jwe 44 ## Adapted-By: jwe
29 45
30 function t = substr (s, offset, len) 46 function t = substr (s, offset, len)