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

Home » Public Forums » archive » Re: String Processing Question
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: String Processing Question [message #42860 is a reply to message #42859] Thu, 03 March 2005 13:47 Go to previous messageGo to previous message
Sobwom is currently offline  Sobwom
Messages: 2
Registered: March 2005
Junior Member
David Fanning wrote:
> Folks,
>
> My mind goes into shutdown mode whenever the subject of
> string processing comes up. It always has, I don't know
> why.
>
> I have a method of doing this, but is looks like
> a crock. Here is the situation.
>
> I have a variable:
>
> animal = 'Coyote'
>
> And I have a string:
>
> myString = 'My favorite animal is {1}.
>
> I want to replace "{1}" with "Coyote". What is the
> best way to do that, given that "{1}' can occur
> anywhere in the string?
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming: http://www.dfanning.com/

Try StrSplit():
animal = 'Coyote'
myString = 'My favorite animal is {1}.'
newString = StrJoin(StrSplit(myString, '\{1\}', /Regex, /Extract, $
/Preserve_Null), animal)
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: IDL without X on Linux
Next Topic: String Processing Question

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

Current Time: Sat Oct 11 18:59:39 PDT 2025

Total time taken to generate the page: 0.96096 seconds