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

to-octal function (See related posts)

    to-octal: func [
        "Converts an integer to an octal issue!."
        value [integer!] "Value to be converted"
        /width wd
        /local result pad
    ][
        pad: func [val wd] [head insert/dup val #"0" wd - length? val]
        result: copy #   ; empty issue!
        if 0 = value [return pad result any [wd 1]]
        while [0 <> value] [
            insert result value // 8
            value: round/down value / 8
        ]
        pad result any [wd 1]
    ]

You need to create an account or log in to post comments to this site.


Click here to browse all 5059 code snippets

Related Posts