number-lines: func [
"Insert leading line numbers for each line."
input [string! block!]
/local lines lead-wd
][
lines: any [all [block? input input] parse/all input form newline]
lead-wd: length? form length? lines
repeat i length? lines [
insert lines/:i join pad-num i lead-wd ": "
]
either block? input [lines] [rejoin delimit lines newline]
]
You need to create an account or log in to post comments to this site.