changeset 3320:b0b71d14dab9

[project @ 1999-10-22 09:46:23 by jwe]
author jwe
date Fri, 22 Oct 1999 09:46:23 +0000
parents a4f11eae45c4
children 6923abb04e16
files scripts/ChangeLog scripts/strings/split.m
diffstat 2 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog
+++ b/scripts/ChangeLog
@@ -1,3 +1,8 @@
+1999-10-22  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* strings/split.m: If the string to be split is empty, just return
+	an empty string.
+
 1999-10-21  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* Makefile.in (ALL_M_FILES): New macro.
--- a/scripts/strings/split.m
+++ b/scripts/strings/split.m
@@ -37,7 +37,10 @@
   l_s = length (s);
   l_t = length (t);
 
-  if (l_s < l_t)
+  if (l_s == 0)
+    m = "";
+    return;
+  elseif (l_s < l_t)
     error ("split: s must not be shorter than t");
   endif
 
@@ -70,7 +73,6 @@
 
   m = eval (sprintf ("str2mat (%s);", cmd));
 
-
   else
     error ("split:  both s and t must be strings");
   endif