|
From: m s. <mw...@us...> - 2009-02-05 03:04:43
|
>
> Message: 1
> Date: Tue, 3 Feb 2009 15:21:30 -0800
> From: Ethan Merritt <merritt@u.washington.edu>
> Subject: Re: string function: definition of a function
> To: Petr Mikulik <mi...@ph...>
> Cc: gnu...@li..., "James R. Van Zandt"
> <jr...@co...>
> Message-ID: <200902031521.30590.merritt@u.washington.edu>
> Content-Type: text/plain; charset="iso-8859-1"
>
> On Tuesday 03 February 2009 14:39:43 Petr Mikulik wrote:
> > > Gnuplot's strstrt() function is just a wrapper for the C
> > library routine strstr().
> > > In C you could do:
> > > > char *piece = "/some/long/path/name";
> > > char *end;
> > > > while (end = strstr( piece, "/" ))
> > > do {piece = end+1;}
> > > > Unfortunately, gnuplot doesn't support while/do so I think
> > you are out of luck.
> >
> > We can add new function strstrtrev("piece", "/") that would
> > return the last occurence of the substring.
> >
> > Would it be useful to have function for handling file names
> > strfileparts('/home/me/bla.dat',n)
> > which would return path (for n=1), name (n=2) and extension (n=3)?
>
> These sound very specialized. Why do we need such file-oriented string
> operations, that even the standard C library does not support?
If the desire is to have the ability to parse file names, why not
implement "dirname" and "basename" equivalents?
Mike Sutton
--
Be Yourself @ mail.com!
Choose From 200+ Email Addresses
Get a Free Account at www.mail.com
|