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

Home » Public Forums » archive » Re: format string with many many quotation marks
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: format string with many many quotation marks [message #54736] Thu, 05 July 2007 14:55 Go to previous message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
On Jul 5, 3:01 pm, "Ryan." <rchug...@gmail.com> wrote:
> On Jul 5, 4:37 pm, "Ryan." <rchug...@gmail.com> wrote:
>
>
>
>> Dear All,
>
>> I'm trying to create a format string that looks like this: ( 5("'",
>> A0, "'", :, ", ") ) <- There are single quotation marks between the
>> first two double quotations.
>
>> I want to get something like this
>
>> a = SINDGEN(6)
>> print, a, FORMAT=val_fmt
>
>> to get:
>> '0', '1', '2', '3', '4', '5'
>
>> What i currently have for a format string is this:
>> val_fmt = '( ' + STRTRIM(STRING(cnt), 2) + $
>> '(' + "'" + ', A0, ' + "'" + ', :, ", ") )'
>
>> This one is wrong because it does not contain the double quotation
>> marks enclosing the single quotation marks. Can someone please
>> explain to me how I could do it or tips on how to use the BYTE method
>> to produce a string output like this.
>
>> Thanks,
>> Ryan.
>
> Hey All,
>
> I've solved my own problem. For those who are interested i just had
> to split it up into many pieces:
> val_fmt='( 5(' + '"' + "'" + '"' + ', A0, ' + '"' + "'" + '"' + ', :,
> ", ") )'
>
> If anyone has an easier, feel free to post. =)
>
> Ryan.

To get a ' in a string that is quoted with 's, use two 's. For
example, 'Pulcinella''s Pizza' or in your case:

IDL> print, a, format='(6("''", I0, "''", :, ", "))'
'0', '1', '2', '3', '4', '5'

Mike
--
www.michaelgalloy.com
[Message index]
 
Read Message
Read Message
Previous Topic: Re: about WSET
Next Topic: Re: vm cwd in *nix

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

Current Time: Wed Oct 08 18:52:29 PDT 2025

Total time taken to generate the page: 0.00777 seconds