[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Single vs. Double Quotes
From: |
Rik |
Subject: |
Re: Single vs. Double Quotes |
Date: |
Sun, 16 Oct 2011 12:52:15 -0700 |
On 10/16/2011 08:53 AM, Ben Abbott wrote:
> On Oct 15, 2011, at 5:07 PM, John W. Eaton wrote:
>
>> On 15-Oct-2011, Michael Goffioul wrote:
>>
>> | On Sat, Oct 15, 2011 at 7:08 PM, John W. Eaton <address@hidden> wrote:
>> | > On 15-Oct-2011, Michael Goffioul wrote:
>> | >
>> | > | way.This is could be achieved as easily as:
>> | > |
>> | > | strrep (delimiter_string, '\n', "\n")
>> | >
>> | > I'm not sure, but I don't think it is quite this simple. WDMD if the
>> | > delimiter string is set to '\\n'? Is this recognized as a
>> | > two-character sequence backslash and n, or is it backslash and NL?
>> | >
>> | > In *printf, I think it is backslash and n, so it would be unfortunate
>> | > if the delimiter string in strread did something different.
>> |
>> | You're right, this was just a quick hack I considered, but far from a
>> | good solution. Your other solution is better. I also thought about
>> | that, but was afraid of other side-effects due to the use of sprintf.
>> | Doubling % characters should prevent them.
>>
>> Another possibility is do_string_escapes. It should still be applied
>> only to single-quoted strings in strread, but it saves you the step of
>> doubling the % characters and it only does backslash-style escape
>> processing, so it might be faster than sprintf.
>>
>> jwe
>
> Is there a robust way to determine whether a string is single-quoted or
> double-quoted?
Ben,
I'm not sure if this is the absolutely perfect way to do it but ...
typeinfo ("abc")
ans = string
typeinfo ('abc')
ans = sq_string
The 'sq' stands for Single Quote.
Cheers,
Rik
> Ben
>
- Re: Single vs. Double Quotes, Rik, 2011/10/15
- Re: Single vs. Double Quotes, Michael Goffioul, 2011/10/15
- Re: Single vs. Double Quotes, John W. Eaton, 2011/10/15
- Re: Single vs. Double Quotes, Michael Goffioul, 2011/10/15
- Re: Single vs. Double Quotes, John W. Eaton, 2011/10/15
- Re: Single vs. Double Quotes, Ben Abbott, 2011/10/16
- Re: Single vs. Double Quotes,
Rik <=
- Re: Single vs. Double Quotes, Ben Abbott, 2011/10/16
- Re: Single vs. Double Quotes, John W. Eaton, 2011/10/17
- Re: Single vs. Double Quotes, Ben Abbott, 2011/10/17
- Re: Single vs. Double Quotes, John W. Eaton, 2011/10/17
Re: Single vs. Double Quotes, Rik, 2011/10/15
Re: Single vs. Double Quotes, Søren Hauberg, 2011/10/15
Re: Single vs. Double Quotes, John W. Eaton, 2011/10/15