Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

number-lines function

    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]
    ]
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS