Note that the verbs joinstring and splitstring are available as part
of stdlib.ijs in J7.
In J6 I think you may need to load the strings script first (require 'strings')
   joinstring
''&$: :(#@[ }. <@[ ;@,. ])
   splitstring
#@[ }.&.> [ (E. <;.1 ]) ,
   ',' splitstring 'Clifford,the,big,red,dog'
┌────────┬───┬───┬───┬───┐
│Clifford│the│big│red│dog│
└────────┴───┴───┴───┴───┘
   joinstring ',' splitstring 'Clifford,the,big,red,dog'
Cliffordthebigreddog
   ',' joinstring ',' splitstring 'Clifford,the,big,red,dog'
Clifford,the,big,red,dog
   '","' joinstring ',' splitstring 'Clifford,the,big,red,dog'
Clifford","the","big","red","dog



On Sat, Nov 5, 2011 at 11:43 AM, Raul Miller <rauldmil...@gmail.com> wrote:
> Try:
>
>   split=: <;._1@,
>   '/' split 'one/two/three'
>
> (I probably should have included examples in that original message?
> Unfortunately, that site does not show next or previous in thread...
> so I do not remember the context.)
>
> --
> Raul
>
> On Fri, Nov 4, 2011 at 3:54 PM, Andrew Pennebaker
> <andrew.penneba...@gmail.com> wrote:
>> Ah, Raul Miller has an intuitive
>> join<http://permalink.gmane.org/gmane.comp.lang.j.programming/10302>function.
>>
>> join =: #@[ }. [:;,L:0
>>
>> I'd give an example, but I can't find A) a split function that doesn't give
>> a domain error or B) syntax for a literal array of strings.
>>
>> Cheers,
>>
>> Andrew Pennebaker
>> www.yellosoft.us
>>
>> On Fri, Nov 4, 2011 at 3:49 PM, Andrew Pennebaker <
>> andrew.penneba...@gmail.com> wrote:
>>
>>> Can someone give an example of joinstring? I want to join a list of
>>> strings together as one string.
>>>
>>> Something like (forgive my syntax):
>>>
>>> xs =: 'a' 'b' 'c'
>>> alltogether =: '' joinstring xs
>>> byspaces =: ' ' joinstring xs
>>>
>>> Cheers,
>>>
>>> Andrew Pennebaker
>>> www.yellosoft.us
>>>
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to