help-octave
[Top][All Lists]
Advanced

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

Re: Equivalent of Perl 'join' ?


From: Ben Abbott
Subject: Re: Equivalent of Perl 'join' ?
Date: Thu, 16 Dec 2010 08:02:48 -0500

On Dec 16, 2010, at 5:13 AM, CdeMills wrote:

> 
> Hello,
> 
> I'm missing a Perl feature. The join function works as follows:
>   join EXPR,LIST
>               Joins the separate strings of LIST into a single string with
>               fields separated by the value of EXPR, and returns that new
>               string. 
> 
> The EXPR is inserted at each intermediate place. I would like to have such a
> function to emit on a single line all the elements of a string array,
> separated by commas. Before starting writing my own implementation, is there
> an equivalent ?
> 
> Regards
> 
> Pascal

If you'd like to preserve spaces ....

        strcat (strcat (LIST, EXPR){:})

For example ...

        c = {"a", "b", "c"};
        cstrcat (strcat (c, ";"){:})
        ans = a;b;c;

Ben







reply via email to

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