annotate scripts/strings/upper.m @ 6749:f7fdea19da88

[project @ 2007-06-20 18:10:04 by jwe]
author jwe
date Wed, 20 Jun 2007 18:10:04 +0000
parents 34f96dd5441b
children 93c65f2a5668
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3175
096940972434 [project @ 1998-05-18 17:03:01 by jwe]
jwe
parents:
diff changeset
1 ## Copyright (C) 1998 John W. Eaton
096940972434 [project @ 1998-05-18 17:03:01 by jwe]
jwe
parents:
diff changeset
2 ##
096940972434 [project @ 1998-05-18 17:03:01 by jwe]
jwe
parents:
diff changeset
3 ## This file is part of Octave.
096940972434 [project @ 1998-05-18 17:03:01 by jwe]
jwe
parents:
diff changeset
4 ##
096940972434 [project @ 1998-05-18 17:03:01 by jwe]
jwe
parents:
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
096940972434 [project @ 1998-05-18 17:03:01 by jwe]
jwe
parents:
diff changeset
6 ## under the terms of the GNU General Public License as published by
096940972434 [project @ 1998-05-18 17:03:01 by jwe]
jwe
parents:
diff changeset
7 ## the Free Software Foundation; either version 2, or (at your option)
096940972434 [project @ 1998-05-18 17:03:01 by jwe]
jwe
parents:
diff changeset
8 ## any later version.
096940972434 [project @ 1998-05-18 17:03:01 by jwe]
jwe
parents:
diff changeset
9 ##
096940972434 [project @ 1998-05-18 17:03:01 by jwe]
jwe
parents:
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
096940972434 [project @ 1998-05-18 17:03:01 by jwe]
jwe
parents:
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
096940972434 [project @ 1998-05-18 17:03:01 by jwe]
jwe
parents:
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
096940972434 [project @ 1998-05-18 17:03:01 by jwe]
jwe
parents:
diff changeset
13 ## General Public License for more details.
096940972434 [project @ 1998-05-18 17:03:01 by jwe]
jwe
parents:
diff changeset
14 ##
096940972434 [project @ 1998-05-18 17:03:01 by jwe]
jwe
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
096940972434 [project @ 1998-05-18 17:03:01 by jwe]
jwe
parents:
diff changeset
16 ## along with Octave; see the file COPYING. If not, write to the Free
5307
4c8a2e4e0717 [project @ 2005-04-26 19:24:27 by jwe]
jwe
parents: 5053
diff changeset
17 ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
4c8a2e4e0717 [project @ 2005-04-26 19:24:27 by jwe]
jwe
parents: 5053
diff changeset
18 ## 02110-1301, USA.
3175
096940972434 [project @ 1998-05-18 17:03:01 by jwe]
jwe
parents:
diff changeset
19
3416
493df428100e [project @ 2000-01-11 07:03:30 by jwe]
jwe
parents: 3407
diff changeset
20 ## -*- texinfo -*-
3499
3e3e14ad5149 [project @ 2000-01-31 05:18:07 by jwe]
jwe
parents: 3416
diff changeset
21 ## @deftypefn {Function File} {} upper (@var{s})
5676
9c9eac3a6513 [project @ 2006-03-16 04:09:07 by jwe]
jwe
parents: 5642
diff changeset
22 ## Transform all letters in the character string (or cell array of
9c9eac3a6513 [project @ 2006-03-16 04:09:07 by jwe]
jwe
parents: 5642
diff changeset
23 ## character strings) @var{s} to upper case.
9c9eac3a6513 [project @ 2006-03-16 04:09:07 by jwe]
jwe
parents: 5642
diff changeset
24 ## @seealso{lower, tolower, toupper}
3407
5e0a0b1cba43 [project @ 2000-01-06 03:13:55 by jwe]
jwe
parents: 3175
diff changeset
25 ## @end deftypefn
3175
096940972434 [project @ 1998-05-18 17:03:01 by jwe]
jwe
parents:
diff changeset
26
096940972434 [project @ 1998-05-18 17:03:01 by jwe]
jwe
parents:
diff changeset
27 ## Author: jwe
096940972434 [project @ 1998-05-18 17:03:01 by jwe]
jwe
parents:
diff changeset
28
096940972434 [project @ 1998-05-18 17:03:01 by jwe]
jwe
parents:
diff changeset
29 function retval = upper (s)
096940972434 [project @ 1998-05-18 17:03:01 by jwe]
jwe
parents:
diff changeset
30
096940972434 [project @ 1998-05-18 17:03:01 by jwe]
jwe
parents:
diff changeset
31 if (nargin != 1)
6046
34f96dd5441b [project @ 2006-10-10 16:10:25 by jwe]
jwe
parents: 6023
diff changeset
32 print_usage ();
3175
096940972434 [project @ 1998-05-18 17:03:01 by jwe]
jwe
parents:
diff changeset
33 endif
096940972434 [project @ 1998-05-18 17:03:01 by jwe]
jwe
parents:
diff changeset
34
5676
9c9eac3a6513 [project @ 2006-03-16 04:09:07 by jwe]
jwe
parents: 5642
diff changeset
35 if (ischar (s))
9c9eac3a6513 [project @ 2006-03-16 04:09:07 by jwe]
jwe
parents: 5642
diff changeset
36 retval = toupper (s);
9c9eac3a6513 [project @ 2006-03-16 04:09:07 by jwe]
jwe
parents: 5642
diff changeset
37 elseif (iscellstr (s))
6023
75a828280d68 [project @ 2006-10-03 02:14:21 by jwe]
jwe
parents: 5676
diff changeset
38 retval = cellfun (@toupper, s, "UniformOutput", false);
5676
9c9eac3a6513 [project @ 2006-03-16 04:09:07 by jwe]
jwe
parents: 5642
diff changeset
39 else
9c9eac3a6513 [project @ 2006-03-16 04:09:07 by jwe]
jwe
parents: 5642
diff changeset
40 error ("upper: `s' must be a string or cell array of strings");
9c9eac3a6513 [project @ 2006-03-16 04:09:07 by jwe]
jwe
parents: 5642
diff changeset
41 endif
3175
096940972434 [project @ 1998-05-18 17:03:01 by jwe]
jwe
parents:
diff changeset
42
096940972434 [project @ 1998-05-18 17:03:01 by jwe]
jwe
parents:
diff changeset
43 endfunction