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

Home » Public Forums » archive » Re: Single Quotes, Double Quotes
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: Single Quotes, Double Quotes [message #11673] Mon, 18 May 1998 00:00 Go to previous message
offenbrg is currently offline  offenbrg
Messages: 31
Registered: August 1993
Member
Charles Cavanaugh <cavanaug@nicole.eos.ucar.edu> writes:


> --------------F486C25E1BA64765FD765959
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit

> Can anyone please explain to me why the line

> asciiutc = "1993-09-19T06:30:00.000000Z"

> fails compilation with the error message

> asciiutc = "1993-09-19T06:30:00.000000Z"
> ^
> % Syntax error.

> but the same line, using single quotes instead of double
> quotes, compiles.


The problem has to do with the way IDL creates octal (base-8) numbers.
To indicate that a number is octal, it is preceded by a double quote.
The problem arises when the leading character of your string is a numeral.

In your example, the "1 indicates an octal expression, which it processes
as a number (the 9s are confusing it a little); then it subtracts 09, a
decimal number, subtracts 19, and then comes to a T, which makes no sense
at all in an arithmetic expression, so it stops.

In short, the ' and the " are not interchangble WHEN the first character
of your string constant is a numeral.



Examples:

;
;Octal expression --- leading "
;
IDL> help,"123
<Expression> INT = 83

;
;String expression --- leading '
;
IDL> help,'123
<Expression> STRING = '123'

;
;Hexadecimal expression --- surrounded by '' with trailing x.
;
IDL> help,'123'x
<Expression> INT = 291



Hope all this helps!

Joel Offenberg
--
"...And I am unanimous in this" - Mrs. Slocumbe
------------------------------------------------------------ -----------------
| Joel D Offenberg | Joel.D.Offenbrg.1@gsfc.nasa.gov |
| Raytheon STX, NASA/GSFC/LASP & STScI | UIT & NGST (301) 286-5801 |
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: contour and backingstore
Next Topic: IDL Object Graphics Update

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

Current Time: Sat Oct 11 11:14:39 PDT 2025

Total time taken to generate the page: 0.23907 seconds