Boxed sentences and paragraphs

15 views
Skip to first unread message

pietdion

unread,
Dec 2, 2024, 6:53:18 PM12/2/24
to forum
Here is my problem:

x=.'hello there ',CR, 'stranger'

x

hello there

stranger

<x

+---------------------+

|hello there stranger|

+---------------------+


Is there an >>easy way<< for the boxing to respect the sentences?  

That is I would like ( I've manually entered the response.)


+---------------------+

|hello there   |

|stranger. |

+---------------------+

Henry Rich

unread,
Dec 2, 2024, 6:57:16 PM12/2/24
to fo...@jsoftware.com
   x=.'hello there ',CR, 'stranger'
   < ];._2 ,&CR x
+------------+
|hello there |
|stranger    |
+------------+

This doesn't install the period.

Henry Rich

To unsubscribe from this group and stop receiving emails from it, send an email to forum+un...@jsoftware.com.

Mike Day

unread,
Dec 2, 2024, 7:03:42 PM12/2/24
to fo...@jsoftware.com
   x=.'hello there',CR,'stranger'
   CR cut x
┌───────────┬────────┐
│hello there│stranger│
└───────────┴────────┘

Sorry,  looks awful on this iPad,  but cut will cut it!  
cut is in stdlib.ijs,

Mike

Sent from my iPad

On 2 Dec 2024, at 23:53, pietdion <piet...@gmail.com> wrote:

Here is my problem:
To unsubscribe from this group and stop receiving emails from it, send an email to forum+un...@jsoftware.com.

Mike Day

unread,
Dec 2, 2024, 7:09:05 PM12/2/24
to fo...@jsoftware.com
Oops,  not quite what you wanted...
M

Sent from my iPad

On 3 Dec 2024, at 00:03, Mike Day <mike_l...@tiscali.co.uk> wrote:



pietdion

unread,
Dec 2, 2024, 7:31:05 PM12/2/24
to forum, Henry Rich
I see how 

< ];._2 ,&CR x

works but don't understand WHY it works.   There's a cut based on  (and discard of) CR and then an echo of the result
The result is successive "lines" of x.
All the lines are then boxed.

Don't understand why it works

Henry Rich

unread,
Dec 2, 2024, 10:05:48 PM12/2/24
to pietdion, forum
The part you might not understand is a peculiarity of boxed display.  Inside boxes, nondisplayable characters are usually displayed as a space.  Thus, strings containing LF or CR do not format as multiple lines.  To get multiple lines you must convert the string into a table, one row per line.

The code cuts the string and reassembles it into a 2x12 table (the second row is filled).  The box covers the entire table.

I observe that ASCII code points 11 and 12 do seem to take a newline, even inside a box, but that seems to merely mess up the boxing.

Henry Rich
Reply all
Reply to author
Forward
0 new messages