comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Determining a safe variable name from a string
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Determining a safe variable name from a string [message #51032 is a reply to message #51029] Tue, 31 October 2006 10:15 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Ben Panter writes:

> I'm sure I've seen this here before, but extensive googling didn't
> trawl anything up. I'd like to be able to convert a random string into
> something I can use for a variable name (heavy execute'ing going on
> here). Something that clears out all the ./*/&//'s and the like. Ideally
> it would replace them with something useful, realistically I'd be happy
> if it just removed the unsafe characters from the string.
>
> something like:
>
> res=wonderful_routine('vmax_z0.1_0.3')
> print, res
> vmax_z0p1_0p3
>
> I've already written something similar which I can butcher, but I'm
> sure there was an IDL routine that did this already?

I think you must be talking about that wonderful (nee miraculous)
function Stregex. Combined with StrSplit and StrJoin, fabulous
things can be done in a single line!

http://www.dfanning.com/code_tips/stringsubs.html

Cheers,

David

P.S. Have you moved back to Edinburgh? Is your apartment
big enough for a visitor? :-)

--
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.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: xobjview creates phantom font object?
Next Topic: Re: Math Question

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Nov 29 01:56:37 PST 2025

Total time taken to generate the page: 0.24074 seconds