Have a look at

    </. 4 4 $ 'abcdefghijklmnop'

Henry Rich

On 7/10/2012 10:16 AM, Rudi Mann wrote:
> Ian,
>
> thanks for the solution!
>
> Devon,
>
> the CRLFs come from the fact that the data source was a text editor. I
> imported the file as string and wanted to reshape it into a character
> matrix to subsequently strip the last two columns to get rid of the
> CRLFs when I stumbled over the two-byte-character issue.
>
> This is part of an approach to solve one of those word-search puzzles
> where one is given a rectangular letter array and has to find all the
> words which can run in any of the eight principal directions. What I
> still need is an elegant expression that converts a character matrix
> into its diagonal strings (as an array of strings or another array),
> like:
>
> ]original=. 3 4$'ABCDEFGHIJKL'
> ABCD
> EFGH
> IJKL
>
> diag original
>     A
>    BE
> CFI
> DGJ
>    HK
>     L
>
> I'm currently trying some index magic, but I think there may be a more
> direct approach.
>
> Rudi
>
> Am 10.07.2012 um 15:42 schrieb Devon McCormick:
>
>> Also, you may find a CRLF delimited series of strings less handy to
>> use than a more J-like representation like this:
>>
>>    $cs=.'ABCD';'DEÄF';'GÖßI';'ÄÖÜß'
>> 4
>>
>> or the tabular version:
>>
>>    $>cs
>> 4 8
>>> cs
>> ABCD
>> DEÄF
>> GÖßI
>> ÄÖÜß
>>
>> It's easy enough to convert this to the form you originally gave:
>>
>>    ;cs,&.><CR,LF
>> ABCD
>> DEÄF
>> GÖßI
>> ÄÖÜß
>>
>>    $;cs,&.><CR,LF
>> 31
>>
>> But that's the sort of thing I would usually only do when I'm ready to
>> output the strings for printing or something.
>>
>> On Tue, Jul 10, 2012 at 6:09 AM, Ian Clark <earthspo...@gmail.com>
>> wrote:
>>> You've got utf-8 chars in there. You need to convert to "wide" chars,
>>> then you'll get a matrix that behaves itself.
>>>
>>> These links may be helpful:
>>> http://www.jsoftware.com/jwiki/Guides/Unicode
>>> http://www.jsoftware.com/jwiki/Guides/UnicodeGettingStarted
>>>
>>>
>>> On Tue, Jul 10, 2012 at 10:46 AM, Rudi Mann <r...@happyplating.eu>
>>> wrote:
>>>> Hi,
>>>>
>>>> yesterday I stumbled over the following feature:
>>>>
>>>> charstring=.'ABCD',CR,LF,'DEÄF',CR,LF,'GÖßI',CR,LF,'ÄÖÜß',CR,LF
>>>>
>>>>   charstring
>>>> ABCD
>>>> DEÄF
>>>> GÖßI
>>>> ÄÖÜß
>>>>
>>>>   #charstring
>>>> 31
>>>> (How bizarre! I counted 24; 16 letters and 8 control characters!)
>>>>
>>>> I want to create a 4 by 4 character array from this string in
>>>> order to
>>>> perform operations like transpose, row and column indexing, diagonal
>>>> extraction etc. How can I do that?
>>>>
>>>> Rudi
>>>> r...@happyplating.eu
>>>>
>>>>
>>>>
>>>>
>>>> ----------------------------------------------------------------------
>>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>> ----------------------------------------------------------------------
>>> For information about J forums see http://www.jsoftware.com/
>>> forums.htm
>>
>>
>>
>> --
>> Devon McCormick, CFA
>> ^me^ at acm.
>> org is my
>> preferred e-mail
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>
> Rudolf Mann
>
> Happy Plating GmbH
> Viktor Kaplan Straße 2 Objekt D
> A-2700 Wiener Neustadt
> Austria
>
> Tel. +43 (0) 2622 23842-19
> Fax +43 (0) 2622 23842-40
> www.happyplating.at
>
> Der Inhalt dieser E-Mail ist vertraulich und ausschliesslich fuer den
> bezeichneten Adressaten bestimmt.
>
> Wenn Sie nicht der vorgesehene Adressat dieser E-Mail, dessen
> Vertreter oder auf dessen Verteiler sein sollten,  so beachten Sie
> bitte, dass jede Form der Kenntnisnahme, Veroeffentlichung,
> Vervielfaeltigung oder Weitergabe des Inhalts dieser E-Mail
> unzulaessig ist.
>
> Wir bitten Sie, sich in diesem Fall mit dem Absender der E-Mail in
> Verbindung zu setzen und das Email zu vernichten.
>
> Die Versendung von E-Mails an uns hat keine fristwahrende Wirkung.
>
>
>
> The information contained in this email is confidential.
>
> It is intended solely for the addressee.
>
> Access to this email by anyone else is unauthorized.
>
> If you are not the intended recipient (or have received this email in
> error), his/her deputy or on his/hers distribution list,  any form of
> disclosure, reproduction, distribution, copying or any action taken or
> refrained from in reliance on it, is prohibited and may be unlawful.
>
> Please notify the sender immediately and destroy this e-mail.
>
> The sending of emails to us does not havy any suspensive effect.
>
>
>
>
> ----------------------------------------------------------------------
> 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