[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: strjoin change ramifications with escape sequence behavior
From: |
Ben Abbott |
Subject: |
Re: strjoin change ramifications with escape sequence behavior |
Date: |
Sun, 16 Jun 2013 20:02:05 +0800 |
On Jun 16, 2013, at 11:08 AM, Ben Abbott wrote:
> On Jun 16, 2013, at 8:41 AM, Ben Abbott wrote:
>
>> On Jun 16, 2013, at 7:37 AM, Daniel J Sebald wrote:
>>
>>> On 06/15/2013 05:45 PM, Stefan Mahr wrote:
>>>>
>>>> That's true for your command above, but you need the extra brackets to
>>>> join the results:
>>>>
>>>> [[cstr(:).'; delimiter(:).']{:}]
>>>>
>>>>> while the return value after Stefan's change shows only the first
>>>>> portion of that result. I guess a routine can't return multiple answers.
>>>>
>>>> I think you lost the additional brackets, but no idea why.
>>>
>>> OK, thanks. Bad copy on my part. I'm seeing consistent results now.
>>>
>>> Dan
>>
>> Dan, I think you did find a problem, but single-quotes are needed.
>>
>> From Matlab
>>
>> strjoin({'Octave','Scilab'}, '\n')
>>
>> ans =
>>
>> Octave
>> Scilab
>>
>> From Octave
>>
>> strjoin({'Octave','Scilab'}, '\n')
>> ans = Octave\nScilab
>>
>> So the second string needs to be escaped.
>>
>> What about the first? Trying Matlab again..
>>
>> strjoin({'Octave\n','Scilab\n'}, 'foo')
>>
>> ans =
>>
>> Octave\nfooScilab\n
>>
>> No. Only the second string.
>>
>> So a patch that implements ..
>>
>> strjoin({'Octave','Scilab'}, do_string_escapes ('\n'))
>>
>> ... should do the job.
>>
>> Ben
>
>
> There's a bit of a parallel discussion on the patch-tracker.
>
> https://savannah.gnu.org/patch/index.php?8066
>
> Ben
Stephan proposed a patch, and I've pushed it.
http://hg.savannah.gnu.org/hgweb/octave/rev/70ea511edbc4
Ben