changeset 5762:0163e7d69161

[project @ 2006-04-14 15:37:38 by jwe]
author jwe
date Fri, 14 Apr 2006 15:37:38 +0000
parents f78d64fbe590
children 2d055c8fa019
files scripts/ChangeLog scripts/strings/strcmpi.m
diffstat 2 files changed, 12 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Fri Apr 14 04:47:21 2006 +0000
+++ b/scripts/ChangeLog	Fri Apr 14 15:37:38 2006 +0000
@@ -1,3 +1,8 @@
+2006-04-14  Bill Denney  <denney@seas.upenn.edu>
+
+ 	* strings/strcmpi.m: Return false instead of error if args are not
+	char or cellstr.
+
 2006-04-10  John W. Eaton  <jwe@octave.org>
 
 	* miscellaneous/dir.m: Ensure that returned structure array is
--- a/scripts/strings/strcmpi.m	Fri Apr 14 04:47:21 2006 +0000
+++ b/scripts/strings/strcmpi.m	Fri Apr 14 15:37:38 2006 +0000
@@ -40,9 +40,13 @@
 function retval = strcmpi (s1, s2)
 
   if (nargin == 2)
-    ## Note that we don't use tolower here because we need to be able to
-    ## handle cell arrays of strings.
-    retval = strcmp (lower (s1), lower (s2));
+    if ((ischar(s1) || iscellstr(s1)) && (ischar(s2) || iscellstr(s2)))
+      ## Note that we don't use tolower here because we need to be able
+      ## to handle cell arrays of strings.
+      retval = strcmp (lower (s1), lower (s2));
+    else
+      retval = false;
+    endif
   else
     usage ("strcmpi (s1, s2)");
   endif