Re: str_sep bug [message #7520 is a reply to message #7501] |
Mon, 25 November 1996 00:00  |
Phil Williams
Messages: 78 Registered: April 1996
|
Member |
|
|
Sorry to answer my own question. BUT, after posting I searched the
str_sep routine and think I located the bug. It's at line 122 of
str_sep.pro. The line reads:
else arr(i) = strmid(s, spos < strlen(spos) - 1, strlen(s))
but should read:
else arr(i) = strmid(s, spos-strlen(sep), strlen(s))
I still think that there is a "bug." Although some would call it a
feature? It's that the last element in the seperated list still has the
seperator attached.
Hope this helps,
Phil
Phil Williams wrote:
>
> I think that I have found a bug in the str_sep.pro function. Observe
> the following:
>
> IDL> t = 'apples, oranges, peaches'
> IDL> print,str_sep(t,',')
> apples oranges , peaches
> IDL> print,str_sep(t,', ')
> apples oranges nges, peaches
>
> It appears that the last element is messed up when you add the space to
> the separator it fails on the last element.
>
> Any help would be appreciated.
>
> Phil
> --
> /*********************************************************** ********/
> Phil Williams, Ph.D.
> Research Instructor
> Children's Hospital Medical Center "One man gathers what
> Imaging Research Center another man spills..."
> 3333 Burnet Ave. -The Grateful Dead
> Cincinnati, OH 45229
> email: williams@irc.chmcc.org
> URL: http://scuttle.chmcc.org/~williams/
> /*********************************************************** ********/
--
/*********************************************************** ********/
Phil Williams, Ph.D.
Research Instructor
Children's Hospital Medical Center "One man gathers what
Imaging Research Center another man spills..."
3333 Burnet Ave. -The Grateful Dead
Cincinnati, OH 45229
email: williams@irc.chmcc.org
URL: http://scuttle.chmcc.org/~williams/
/*********************************************************** ********/
|
|
|