Re: forward slash in data item name [message #52050] |
Thu, 04 January 2007 09:58 |
maye
Messages: 29 Registered: June 2006
|
Junior Member |
|
|
Happy new year!
Thanks, David.
As usual, I'm stunned that you have time to be so responsive here. ;)
Best regards,
Michael
David Fanning wrote:
> maye writes:
>
>> I wonder if there's a way I can avoid the following problem:
>> I create plot file names automatically from the data item name in a
>> first row of a csv file.
>> Unfortunately, one of the data item names has a forward slash in it
>> (DC/DC), which leads to the case, that my routine wants to create a
>> file name: "DC/DC.jpg" which of course is interpreted as a directory
>> creation.
>> Of course I could check every data item name for such a thing to occur
>> and replace every slash with an underscore, but is there not a simpler
>> way to avoid such caveats?
>
> I'm afraid you are going to have to check it. Probably
> the simplest thing is to just replace the "/" with
> something else. Here is an article that describes an
> easy way to do that:
>
> http://www.dfanning.com/code_tips/stringsubs.html
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: forward slash in data item name [message #52082 is a reply to message #52050] |
Fri, 29 December 2006 09:10  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
maye writes:
> I wonder if there's a way I can avoid the following problem:
> I create plot file names automatically from the data item name in a
> first row of a csv file.
> Unfortunately, one of the data item names has a forward slash in it
> (DC/DC), which leads to the case, that my routine wants to create a
> file name: "DC/DC.jpg" which of course is interpreted as a directory
> creation.
> Of course I could check every data item name for such a thing to occur
> and replace every slash with an underscore, but is there not a simpler
> way to avoid such caveats?
I'm afraid you are going to have to check it. Probably
the simplest thing is to just replace the "/" with
something else. Here is an article that describes an
easy way to do that:
http://www.dfanning.com/code_tips/stringsubs.html
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|