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 

to-octal function

   1  
   2      to-octal: func [
   3          "Converts an integer to an octal issue!."
   4          value [integer!] "Value to be converted"
   5          /width wd
   6          /local result pad
   7      ][
   8          pad: func [val wd] [head insert/dup val #"0" wd - length? val]
   9          result: copy #   ; empty issue!
  10          if 0 = value [return pad result any [wd 1]]
  11          while [0 <> value] [
  12              insert result value // 8
  13              value: round/down value / 8
  14          ]
  15          pad result any [wd 1]
  16      ]
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS