help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with single quotes


From: John W. Eaton
Subject: Re: Problem with single quotes
Date: Thu, 02 Oct 2008 12:31:48 -0400

On  2-Oct-2008, Andreas Yankopolus wrote:

| > | >  2) The escape code for ' inside a single quoted string is ''.
| > | >
| > | > So, the following should work:
| > | >  fprintf ('''')
| > |
| > | I did not know that. That statement prints a double quote in Octave.
| >
| > No, it should print a single ' character, same as Matlab.
| 
| I can only report what I see. I've tried it on Octave 3.0.2 (OS X) and  
| Octave 3.0.0 (Ubuntu Hardy). Both give me a double quote.
| 
| > | I'll give it a shot in Matlab and see what happens.
| 
| A colleague just tried it on Matlab and got a double quote as well.

Try this:

  abs (sprintf (''''))
  abs ('''')

Do they produce 39 (the ASCII code for ') as we would expect, or do
you get 34 (the ASCII code for ")?

You are reading the above correctly, right?  That's four consecutive
single quote characters (i.e., ', ASCII 39 decimal) in the sprintf
call.

jwe


reply via email to

[Prev in Thread] Current Thread [Next in Thread]