[Sidefx-houdini-list] String manipulation
jordibares at the-mill.com
Fri Jun 1 04:33:39 EDT 2007
Thanks everybody for the answers, I find this approach really powerful for
more convoluted tasks but honestly I was expecting some easier and direct
way to manipulate paths and filenames.
I may therefore ask you guys at sidefx to consider adding this kind of
modifiers like the ones in the csh which are simple and very useful (:r :t
:h :e ).
Thanks a lot
On 31/5/07 19:44, "Peter Bowmar" <pbowmar at gmail.com> wrote:
> I and others have written a variety of custom expressions that do
> things like this. So for example, what you want would be, as a custom
> string strip_suffix(string orig; string sepchar)
> string returnme = orig;
> float lastSep = rindex(orig, sepchar);
> if ( lastSep >= 0 )
> returnme = substr(orig,0,lastSep);
> return returnme;
> Now you can just use `strip_suffix($HIPNAME,".")`
> I have a lot of little things like this, as do most people. You just
> keep adding them to your facility's shop-wide Houdini install. Sadly,
> that's not super easy since there is no easy way to load custom
> expressions. We use something in 456.cmd that scans a directory and
> loads all the files with .func on the end using the "exread" command.
> This stuff will be easier in 9 when Python is integrated that's for sure!
> Peter B
> On 31/05/07, jordibares <jordibares at the-mill.com> wrote:
>> > Hi all, I am trying using $HIPNAME and $OS to build the actual output name
>> > of my sequence but I need $HIPNAME to return the name without the
>> > Intead of
>>> > > myscene.hip
>> > I need
>>> > > myscene
>> > I had a look at the expression documentation and managed to do it by
>> > this
>>> > > Echo `substr($HIPNAME, 0, strlen($HIPNAME)-4)`
>> > But I was wondering if there is another way as this seems too convoluted >>
>> > something that at first seem very very necessary.
>> > May be like in the csh
>>> > > Echo $HIPNAME:r ? ????
>> > Thanks in advance
>> > Jb
>> > PS. Can¹t wait to have python inside houdini...
>> > _______________________________________________
>> > Sidefx-houdini-list mailing list
>> > Sidefx-houdini-list at sidefx.com
>> > https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
> Sidefx-houdini-list mailing list
> Sidefx-houdini-list at sidefx.com
More information about the Sidefx-houdini-list