I've used the cascading Format trick too.

I have also found that when the string manipulation involves input of
information external to DX to pass to FileSelector, Import, etc. writing a
little shell or perl script as a DX import filter is easier and more
flexible.


Chris Pelkie <[EMAIL PROTECTED]>@opendx.watson.ibm.com on 01/24/2002
08:06:38 AM

Please respond to [email protected]

Sent by:    [EMAIL PROTECTED]


To:    [email protected]
cc:
Subject:    Re: [opendx-users] String manipulation in DX



>>>
>>
>>Use the Parse module. For your example using the format string
>>"%[^.].txt" would suffice. Unfortunately the parse module doesnt
>>seem to handle the more obvious "%s.txt".
>>
>>Richard.
>>
>>--
>>Richard Guenther <[EMAIL PROTECTED]>
>>PGP: 2E829319 - 2F 83 FC 93 E9 E4 19 E2 93 7A 32 42 45 37 23 57
>>WWW: http://www.anatom.uni-tuebingen.de/~richi/
>
>
>-


Oh, that's purty!

I flipped back through the tattered pages of my O'Reilly "sed & awk"
and maybe finally understand the ^ as exclusion metacharacter! Thanks.

It appears you can be more "parse"imonious here though and simply use "%
[^.]"

But I needed this the other day (to tear off all but the suffix from
a filepath/name input from FileSelector, so thanks!


BTW, David et al., I may have posted in the past, but here's a trick
to stuff a format template manufactured on the fly into Format.
Haven't tried it on Parse, but it should work:

The template string is: "%%%d.%df"
then feed two integers in. This gives you a variable float format
expression, like "%3.1f"
Feed this into the template of another Format and also the float you
want to format.

--

Chris Pelkie
Vice President/Scientific Visualization Producer
Conceptual Reality Presentations, Inc.
30 West Meadow Drive
Ithaca, NY 14850
[EMAIL PROTECTED]


Reply via email to