annotate scripts/strings/strcmpi.m @ 5674:86adc85cc471

[project @ 2006-03-16 03:46:45 by jwe]
author jwe
date Thu, 16 Mar 2006 03:46:45 +0000
parents ec8c33dcd1bf
children 9c9eac3a6513
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5674
86adc85cc471 [project @ 2006-03-16 03:46:45 by jwe]
jwe
parents: 5443
diff changeset
1 ## Copyright (C) 2000 Bill Lash
5185
75a442ecd410 [project @ 2005-03-03 06:59:01 by jwe]
jwe
parents:
diff changeset
2 ##
5186
64fcf6e776be [project @ 2005-03-03 06:59:55 by jwe]
jwe
parents: 5185
diff changeset
3 ## This file is part of Octave.
5185
75a442ecd410 [project @ 2005-03-03 06:59:01 by jwe]
jwe
parents:
diff changeset
4 ##
5186
64fcf6e776be [project @ 2005-03-03 06:59:55 by jwe]
jwe
parents: 5185
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
64fcf6e776be [project @ 2005-03-03 06:59:55 by jwe]
jwe
parents: 5185
diff changeset
6 ## under the terms of the GNU General Public License as published by
64fcf6e776be [project @ 2005-03-03 06:59:55 by jwe]
jwe
parents: 5185
diff changeset
7 ## the Free Software Foundation; either version 2, or (at your option)
64fcf6e776be [project @ 2005-03-03 06:59:55 by jwe]
jwe
parents: 5185
diff changeset
8 ## any later version.
64fcf6e776be [project @ 2005-03-03 06:59:55 by jwe]
jwe
parents: 5185
diff changeset
9 ##
64fcf6e776be [project @ 2005-03-03 06:59:55 by jwe]
jwe
parents: 5185
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
64fcf6e776be [project @ 2005-03-03 06:59:55 by jwe]
jwe
parents: 5185
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
64fcf6e776be [project @ 2005-03-03 06:59:55 by jwe]
jwe
parents: 5185
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
64fcf6e776be [project @ 2005-03-03 06:59:55 by jwe]
jwe
parents: 5185
diff changeset
13 ## General Public License for more details.
5185
75a442ecd410 [project @ 2005-03-03 06:59:01 by jwe]
jwe
parents:
diff changeset
14 ##
75a442ecd410 [project @ 2005-03-03 06:59:01 by jwe]
jwe
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
5186
64fcf6e776be [project @ 2005-03-03 06:59:55 by jwe]
jwe
parents: 5185
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: 5186
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: 5186
diff changeset
18 ## 02110-1301, USA.
5185
75a442ecd410 [project @ 2005-03-03 06:59:01 by jwe]
jwe
parents:
diff changeset
19
5186
64fcf6e776be [project @ 2005-03-03 06:59:55 by jwe]
jwe
parents: 5185
diff changeset
20 ## -*- texinfo -*-
64fcf6e776be [project @ 2005-03-03 06:59:55 by jwe]
jwe
parents: 5185
diff changeset
21 ## @deftypefn {Function File} {} strcmpi (@var{s1}, @var{s2})
5674
86adc85cc471 [project @ 2006-03-16 03:46:45 by jwe]
jwe
parents: 5443
diff changeset
22 ## Ignoring case, return 1 if the character strings @var{s1} and @var{s2}
86adc85cc471 [project @ 2006-03-16 03:46:45 by jwe]
jwe
parents: 5443
diff changeset
23 ## are the same, and 0 otherwise.
5185
75a442ecd410 [project @ 2005-03-03 06:59:01 by jwe]
jwe
parents:
diff changeset
24 ##
5674
86adc85cc471 [project @ 2006-03-16 03:46:45 by jwe]
jwe
parents: 5443
diff changeset
25 ## If either @var{s1} or @var{s2} is a cell array of strings, then an array
86adc85cc471 [project @ 2006-03-16 03:46:45 by jwe]
jwe
parents: 5443
diff changeset
26 ## of the same size is returned, containing the values described above for
86adc85cc471 [project @ 2006-03-16 03:46:45 by jwe]
jwe
parents: 5443
diff changeset
27 ## every member of the cell array. The other argument may also be a cell
86adc85cc471 [project @ 2006-03-16 03:46:45 by jwe]
jwe
parents: 5443
diff changeset
28 ## array of strings (of the same size or with only one element), char matrix
86adc85cc471 [project @ 2006-03-16 03:46:45 by jwe]
jwe
parents: 5443
diff changeset
29 ## or character string.
86adc85cc471 [project @ 2006-03-16 03:46:45 by jwe]
jwe
parents: 5443
diff changeset
30 ##
86adc85cc471 [project @ 2006-03-16 03:46:45 by jwe]
jwe
parents: 5443
diff changeset
31 ## @strong{Caution:} For compatibility with @sc{Matlab}, Octave's strcmpi
86adc85cc471 [project @ 2006-03-16 03:46:45 by jwe]
jwe
parents: 5443
diff changeset
32 ## function returns 1 if the character strings are equal, and 0 otherwise.
86adc85cc471 [project @ 2006-03-16 03:46:45 by jwe]
jwe
parents: 5443
diff changeset
33 ## This is just the opposite of the corresponding C library function.
86adc85cc471 [project @ 2006-03-16 03:46:45 by jwe]
jwe
parents: 5443
diff changeset
34 ## @seealso{strcmp, strncmp, strncmpi}
5186
64fcf6e776be [project @ 2005-03-03 06:59:55 by jwe]
jwe
parents: 5185
diff changeset
35 ## @end deftypefn
5185
75a442ecd410 [project @ 2005-03-03 06:59:01 by jwe]
jwe
parents:
diff changeset
36
75a442ecd410 [project @ 2005-03-03 06:59:01 by jwe]
jwe
parents:
diff changeset
37 ## Author: Bill Lash <lash@tellabs.com>
5186
64fcf6e776be [project @ 2005-03-03 06:59:55 by jwe]
jwe
parents: 5185
diff changeset
38 ## Adapted-by: jwe
5185
75a442ecd410 [project @ 2005-03-03 06:59:01 by jwe]
jwe
parents:
diff changeset
39
5674
86adc85cc471 [project @ 2006-03-16 03:46:45 by jwe]
jwe
parents: 5443
diff changeset
40 function retval = strcmpi (s1, s2)
5185
75a442ecd410 [project @ 2005-03-03 06:59:01 by jwe]
jwe
parents:
diff changeset
41
5186
64fcf6e776be [project @ 2005-03-03 06:59:55 by jwe]
jwe
parents: 5185
diff changeset
42 if (nargin == 2)
5674
86adc85cc471 [project @ 2006-03-16 03:46:45 by jwe]
jwe
parents: 5443
diff changeset
43 retval = strcmp (tolower (s1), tolower (s2));
5186
64fcf6e776be [project @ 2005-03-03 06:59:55 by jwe]
jwe
parents: 5185
diff changeset
44 else
5674
86adc85cc471 [project @ 2006-03-16 03:46:45 by jwe]
jwe
parents: 5443
diff changeset
45 usage ("strcmpi (s1, s2)");
5185
75a442ecd410 [project @ 2005-03-03 06:59:01 by jwe]
jwe
parents:
diff changeset
46 endif
75a442ecd410 [project @ 2005-03-03 06:59:01 by jwe]
jwe
parents:
diff changeset
47
75a442ecd410 [project @ 2005-03-03 06:59:01 by jwe]
jwe
parents:
diff changeset
48 endfunction