Re: [Jprogramming] Character Handling

2012-07-10 Thread Linda Alvord
This gets the rows as you wish, but the spacing is not as you indicated. >mailto:programming-boun...@jsoftware.com] On Behalf Of Raul Miller Sent: Tuesday, July 10, 2012 11:06 AM To: Programming forum Subject: Re: [Jprogramming] Character Handling On Tue, Jul 10, 2012 at 10:16 AM, Rudi M

Re: [Jprogramming] Character Handling

2012-07-10 Thread Raul Miller
On Tue, Jul 10, 2012 at 11:14 AM, Rudi Mann wrote: > BTW, the orientation doesn't really matter, since I need all 4 > diagonal directions anyway. You might be interested in http://jsoftware.com/help/phrases/rotate_reflect.htm Note that an m prefix means that the monadic definition is relevant an

Re: [Jprogramming] Character Handling

2012-07-10 Thread Rudi Mann
Thanks everyone! BTW, the orientation doesn't really matter, since I need all 4 diagonal directions anyway. Am 10.07.2012 um 17:06 schrieb Raul Miller: > On Tue, Jul 10, 2012 at 10:16 AM, Rudi Mann > wrote: >> ]original=. 3 4$'ABCDEFGHIJKL' >> ABCD >> EFGH >> IJKL >> >> diag original >> A

Re: [Jprogramming] Character Handling

2012-07-10 Thread Raul Miller
On Tue, Jul 10, 2012 at 10:16 AM, Rudi Mann wrote: > ]original=. 3 4$'ABCDEFGHIJKL' > ABCD > EFGH > IJKL > > diag original >A > BE > CFI > DGJ > HK >L As Henry points out, verb/. gets diagonals and hands them off to your verb. However, ]/. original has the wrong orientation. So to r

Re: [Jprogramming] Character Handling

2012-07-10 Thread Henry Rich
Have a look at 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 s

Re: [Jprogramming] Character Handling

2012-07-10 Thread Rudi Mann
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-char

Re: [Jprogramming] Character Handling

2012-07-10 Thread Raul Miller
On Tue, Jul 10, 2012 at 5:46 AM, Rudi Mann wrote: > 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? charstring=.'ABCD',CR,LF,'DEÄF',CR,LF,'GÖßI',CR,LF,'ÄÖÜß',CR,LF

Re: [Jprogramming] Character Handling

2012-07-10 Thread 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,&.>

Re: [Jprogramming] Character Handling

2012-07-10 Thread Ian Clark
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

[Jprogramming] Character Handling

2012-07-10 Thread Rudi Mann
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