Thank-you for your suggestion but I am unclear as to how the Compute would
work.
Let's say the first 5 characters of the file name contains the month and
day the data was collected. The rest of the characters in the filename
describe the file but I am just interested in the date and would like to
put the date on the image so that I can easily tell the date of the
image. If I use Compute, with strstr, would I then have to go through a
"Do Loop" and iterate on the month and date to find the correct month and
day? This would probably work but seems to be very inefficient.
Gerry Cheok
At 12:48 PM 3/21/2000 -0500, you wrote:
Format builds strings, so it's no use here.
Parse is essentially C's scanf so it's only useful for picking out say a
float between two strings or something; worthless for picking apart a
string into substrings.
You need Compute(strcmp), (strlen), (strstr). See the online contextual
help or html docs on Compute and go way to the end of the list of operators.
Also, here's another item that came up a while back related to strings that
should be generally useful for the openDX archives. It was a question that
I posed and which was cleverly answered by Frank Suits of IBM (formerly
big-time DX coder, now rich AND famous (:-). )
My question:
>Subject: Is String? Not
>
>Ok, I finally figured out that the documentation is correct
>but my expectations are not.
>
>The Inquire "is float" or "is int" etc. return the boolean
>regarding the type of the input object. However, the Inquiry
>"is string" answers the question "is the input object a string"
>not "is the type of the input object 'string'". This is a very
>different thing. An input which is a string array will yield the
>answer 'false' (0). If you input a single string as the
>Inquire input, "is string" is 'true', but if you Extract a component
>from a field which has type string, the answer is false since the
>input is not a string but an array. Gotcha!
>
>I think there should be added a new Inquiry "is type string".
>Otherwise I have to first Inquire "type" then strcmp the answer to find out.
>Do you know a shorter way?
Here's Frank's reply:
>This is a bug/omission in Inquire with an incredibly ugly but effective
>workaround.
>F is a field with a bunch of components.
>a=Extract(F,"data")
>b=Select(a,0);
>c=Inquire(b, string match, b)
>
>Basically you ask if the first item in the component array is a string by
>doing
>a string
>match of itself with itself. If it isn't a string, the inquire will
fail. If
>it is a string, it will work.
>
>How's that for a hack?
Chris Pelkie
Vice President/Scientific Visualization Producer
Conceptual Reality Presentations, Inc.
30 West Meadow Drive
Ithaca, NY 14850
[EMAIL PROTECTED]