# HG changeset patch # User jwe # Date 940585583 0 # Node ID b0b71d14dab9b29d43e1b1150e36be80637edc58 # Parent a4f11eae45c472ae885ace783ac8b810d35beb2c [project @ 1999-10-22 09:46:23 by jwe] diff --git a/scripts/ChangeLog b/scripts/ChangeLog --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,8 @@ +1999-10-22 John W. Eaton + + * strings/split.m: If the string to be split is empty, just return + an empty string. + 1999-10-21 John W. Eaton * Makefile.in (ALL_M_FILES): New macro. diff --git a/scripts/strings/split.m b/scripts/strings/split.m --- 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