this syntax :
Red []
do load %printF.red
printF/underlined ["Some examples" [20] "This" [-14] "That" [-10] "A Rest" [-8 ] "When" [-12]] #"_"
printF ["none shown" [20] 345.2345 [-14 2 "$ " 'blank] 123.4567 [-10 3] none [-8 ] 2000-1-1 [-12]]
printF ["various 'blank" [20] 98765.7321 [-14 2 "$ " 'blank] -1.87654 [-10 3] 0 [-8 'blank] 2019-3-6 [-12]]
printF ["zero blank / not blank" [20] 0.0 [-14 2 "$ " 'blank] 0 [-10 3] -98 [-8 0 "" 'blank]]
printF ["a block shown" [20] [0 "xyz"] [-14] 0 [-10 3] -98 [-8 0 "" 'blank]]
printF/underlined ["too big float" [20] 98765444444.7321 [-14 2 "$ " 'blank] 1.87654 [-10 3] 54321 [-8 'blank] none [-12]] #"-"
str: printF/asString/underlined ["more underlined" [20] 345.2345 [-14 2 "$ " 'blank] 123.4567 [-10 3] 12345678 [-8 'blank] now/date [-12]] #"="
print [str]
produces this report:
Some examples This That A Rest When
____________________________________________________________________
none shown $ 345.23 123.456 1-Jan-2000
various 'blank $ 98765.73 -1.876 6-Mar-2019
blank / not blank 0.000 -98
a block shown [0 "xyz"] 0.000 -98
too big float $ 98765444444.73 1.876 54321
--------------------------------------------------------------------
more underlined $ 345.23 123.456 12345678 20-Feb-2020
====================================================================
mould :demo1
I noticed in the large numbers such as 98765.73 that there were no comma separators such as 98,765.73
I wasn't sure if that was because it was just an American standard formatting feature or because of the comma being more complicated to include in a number due to a RED dual meaning.
@GaryMiller Yes, because the comma is used as decimal separator in other languages, it can't be used as thousands separator.:
>> 123.45
== 123.45
>> 123,45
== 123.45
However, you can use an apostrophe as a thousands separator:
>> 12'345.67
== 12345.67
>> 12'345,67
== 12345.67
bubble2: func [list [series!]][
until [
tail? next list: skip list either list/1 > list/2 [
swap list next list -1
][1]
] head list
]
Ah, yes, of course, memory consumption grows with growing length of sorted series:
>> recycle/off
>> string: "sdlkjflkjlsdmcvLKJFawjrfaoiajfliuh.ghlskls" ()
>> profile/show [[bubble copy string][bubble2 copy string]]
Count: 1
Time | Time (Per) | Memory | Code
0:00:00.001 | 0:00:00.001 | 360 | [bubble2 copy string]
0:00:00.002 | 0:00:00.002 | 104428 | [bubble copy string]
>> 104428 / 360
== 290.0777777777778
@theSherwood I used the profile func by @greggirwin.
>> profile/show [[bubble copy string][bubble2 copy string]]
Count: 1
Time | Time (Per) | Memory | Code
0:00:00.001 | 0:00:00.001 | 360 | [bubble2 copy string]
0:00:00.003 | 0:00:00.003 | 516 | [bubble copy string]