|
From: Petr M. <mi...@ph...> - 2009-02-02 22:50:56
|
> > seems we don't have "string index" or "string split" functions. > > We do. It is called strstrt(haystack,needle): > > gnuplot> show var GPFUN > GPFUN_f = "f(a,b) = a**2 + sqrt(b*a)" > > gnuplot> print strstrt(GPFUN_f,"=") > 8 > gnuplot> print GPFUN_f[ strstrt(GPFUN_f,"=") : * ] Interesting, I have never used this. How can I get the "reversed" version of it? Just today I needed to extract the last part of the directory, e.g. from /tmp/bla/now I needed to get "now". Finally I've got it by calling shall's `basename` but the reversed version of "strstrt" would help a lot. Further I have noticed `pwd` command from shell is needed to set a variable for the current working directory because gnuplot> pwd just prints it to screen, but I cannot do a=pwd or a=eval pwd Would an automatic variable GPVAL_PWD be the only chance for a portable solution? --- PM |