|
From: Petr M. <mi...@ph...> - 2009-02-03 22:39:57
|
> 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)?
That would be quite handy especially in the "plot for" loop.
> Would an automatic variable GPVAL_PWD be the only chance for a portable
> solution?
I have added it.
---
PM
|