Re: String composition [message #38127] |
Mon, 23 February 2004 06:21 |
Norbert Hahn
Messages: 46 Registered: May 2003
|
Member |
|
|
Edd Edmondson <eddedmondson@hotmail.com> wrote:
> Antonio Santiago <d6522117@est.fib.upc.es> wrote:
>> Hi, sorry about this poor question, but is my first problem with IDL.
>
>> How can i mount a string with a return carriadge. That is like C:
>
>> string = 'hello \n'+ 'bye'
>
>> How can i put the '\n' character?
>
> STRING(10B) (10 being the ascii code for a new line)
>
> eg, mystring='hello'+STRING(10B)+'bye'
That's ok for Unix like operating systems. MS Windows requires
mystring='hello'+STRING([13B,10B])+'bye'
while the Macintosh needs mystring='hello'+STRING(13B)+'bye'
if I'm not mistaken.
You may use the variable !version.os to find out which OS your
program runs on.
Norbert
|
|
|
Re: String composition [message #38132 is a reply to message #38127] |
Mon, 23 February 2004 04:14  |
Edd Edmondson
Messages: 50 Registered: January 2003
|
Member |
|
|
Antonio Santiago <d6522117@est.fib.upc.es> wrote:
> Hi, sorry about this poor question, but is my first problem with IDL.
> How can i mount a string with a return carriadge. That is like C:
> string = 'hello \n'+ 'bye'
> How can i put the '\n' character?
STRING(10B) (10 being the ascii code for a new line)
eg, mystring='hello'+STRING(10B)+'bye'
--
Edd
|
|
|
Re: String composition [message #38133 is a reply to message #38132] |
Mon, 23 February 2004 04:10  |
Pepijn Kenter
Messages: 31 Registered: April 2002
|
Member |
|
|
Antonio Santiago wrote:
> Hi, sorry about this poor question, but is my first problem with IDL.
>
> How can i mount a string with a return carriadge. That is like C:
>
> string = 'hello \n'+ 'bye'
>
> How can i put the '\n' character?
>
> thanks
>
You can use C-style format codes like this:
print, format='(%"hello\nbye")'
Pepijn.
|
|
|