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

number-lines function (See related posts)

    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.


Click here to browse all 4858 code snippets

Related Posts