comparison scripts/strings/lower.m @ 5676:9c9eac3a6513

[project @ 2006-03-16 04:09:07 by jwe]
author jwe
date Thu, 16 Mar 2006 04:09:07 +0000
parents 2618a0750ae6
children 75a828280d68
comparison
equal deleted inserted replaced
5675:c5f6623514c4 5676:9c9eac3a6513
17 ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 ## 02110-1301, USA. 18 ## 02110-1301, USA.
19 19
20 ## -*- texinfo -*- 20 ## -*- texinfo -*-
21 ## @deftypefn {Function File} {} lower (@var{s}) 21 ## @deftypefn {Function File} {} lower (@var{s})
22 ## Transform all letters in the string @var{s} to lower case. 22 ## Transform all letters in the character string (or cell array of
23 ## @seealso{tolower} 23 ## character strings) @var{s} to lower case.
24 ## @seealso{upper, tolower, toupper}
24 ## @end deftypefn 25 ## @end deftypefn
25 26
26 ## Author: jwe 27 ## Author: jwe
27 28
28 function retval = lower (s) 29 function retval = lower (s)
29 30
30 if (nargin != 1) 31 if (nargin != 1)
31 usage ("lower (s)"); 32 usage ("lower (s)");
32 endif 33 endif
33 34
34 retval = tolower (s); 35 if (ischar (s))
36 retval = tolower (s);
37 elseif (iscellstr (s))
38 retval = cell (size (s));
39 for i = 1:(numel (s))
40 retval{i} = tolower(s{i});
41 endfor
42 else
43 error ("lower: `s' must be a string or cell array of strings");
44 endif
35 45
36 endfunction 46 endfunction