datestr bug
Ben Abbott
bpabbott at mac.com
Thu Jul 24 19:32:00 CDT 2008
On Jul 24, 2008, at 9:24 AM, John W. Eaton wrote:
> On 23-Jul-2008, Ben Abbott wrote:
>
> | Another possible solution (hack) is to replace the offending line
> with
> |
> | nd = strfind (str, "d");
> | nd = setdiff (nd, strfind (str,"day"));
> | nd = setdiff (nd, strfind (str,"dnesday"));
> | str(nd) = names_d{weekday (datenum (v(i,1), v(i,2), v(i,3)))};
>
> I'm not applying this change because I think we should be able to come
> up with a proper solution that is not just a band-aid kluge fix.
hmmm ... perhaps strrep.m could be modified to allow for a mask as a
fourth argument?
For example, it might be modified to work as below ...
octave:#> str = "d == dddd";
octave:#> mask = zeros (size (str));
octave:#> [str, mask] = strrep (str, "dddd", "Wednesday", mask)
str = "d == Wednesday"
mask = [0 0 0 0 0 1 1 1 1 1 1 1 1 1]
octave:#> [str, mask] = strrep (str, "d", "W", mask)
str = "W = Wednesday"
mask = [1 0 0 0 0 1 1 1 1 1 1 1 1 1]
The new version of strrep might replace the original, a new function
(__strrep__.m ?) or a subfunction of datestr.
Comments/Suggestions?
Ben
More information about the Bug-octave
mailing list