diff 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
line wrap: on
line diff
--- a/scripts/strings/strcmpi.m
+++ b/scripts/strings/strcmpi.m
@@ -1,4 +1,4 @@
-## Copyright (C) 2000  Bill Lash
+## Copyright (C) 2000 Bill Lash
 ##
 ## This file is part of Octave.
 ##
@@ -19,24 +19,30 @@
 
 ## -*- texinfo -*-
 ## @deftypefn {Function File} {} strcmpi (@var{s1}, @var{s2})
-## Compare two strings, ignoring case, returning 1 if
-## they are the same, and 0 otherwise.
+## Ignoring case, return 1 if the character strings @var{s1} and @var{s2}
+## are the same, and 0 otherwise.
 ##
-## Note: For compatibility with Matlab, Octave's strcmpi function
-## returns 1 if the strings are equal, and 0 otherwise.  This is
-## just the opposite of the corresponding C library function.
+## If either @var{s1} or @var{s2} is a cell array of strings, then an array
+## of the same size is returned, containing the values described above for
+## every member of the cell array. The other argument may also be a cell
+## array of strings (of the same size or with only one element), char matrix
+## or character string.
+##
+## @strong{Caution:} For compatibility with @sc{Matlab}, Octave's strcmpi
+## function returns 1 if the character strings are equal, and 0 otherwise.
+## This is just the opposite of the corresponding C library function.
+## @seealso{strcmp, strncmp, strncmpi}
 ## @end deftypefn
 
 ## Author: Bill Lash <lash@tellabs.com>
 ## Adapted-by: jwe
 
-function status = strcmpi(s1, s2)
+function retval = strcmpi (s1, s2)
 
   if (nargin == 2)
-    status = (ischar (s1) && ischar(s2) && strcmp (upper (s1), upper (s2)));
+    retval = strcmp (tolower (s1), tolower (s2));
   else
-    usage ("strcmpi (s, t)");
+    usage ("strcmpi (s1, s2)");
   endif
 
 endfunction
-