<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: octal code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Mon, 06 Oct 2008 00:04:42 GMT</pubDate>
    <description>DZone Snippets: octal code</description>
    <item>
      <title>to-octal function</title>
      <link>http://snippets.dzone.com/posts/show/1112</link>
      <description>&lt;code&gt;&lt;br /&gt;    to-octal: func [&lt;br /&gt;        "Converts an integer to an octal issue!."&lt;br /&gt;        value [integer!] "Value to be converted"&lt;br /&gt;        /width wd&lt;br /&gt;        /local result pad&lt;br /&gt;    ][&lt;br /&gt;        pad: func [val wd] [head insert/dup val #"0" wd - length? val]&lt;br /&gt;        result: copy #   ; empty issue!&lt;br /&gt;        if 0 = value [return pad result any [wd 1]]&lt;br /&gt;        while [0 &lt;&gt; value] [&lt;br /&gt;            insert result value // 8&lt;br /&gt;            value: round/down value / 8&lt;br /&gt;        ]&lt;br /&gt;        pad result any [wd 1]&lt;br /&gt;    ]&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Tue, 10 Jan 2006 05:59:44 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1112</guid>
      <author>gregg.irwin (Gregg Irwin)</author>
    </item>
    <item>
      <title>from-octal</title>
      <link>http://snippets.dzone.com/posts/show/1111</link>
      <description>&lt;code&gt;&lt;br /&gt;    from-octal: func [&lt;br /&gt;        "Converts an octal number to a decimal value."&lt;br /&gt;        octal [any-string! integer!]&lt;br /&gt;        /local result len&lt;br /&gt;    ][&lt;br /&gt;        result: 0&lt;br /&gt;        octal: form octal&lt;br /&gt;        repeat i len: length? octal [&lt;br /&gt;            result: add result (to integer! form octal/:i) * (8 ** (len - i))&lt;br /&gt;        ]&lt;br /&gt;        any [attempt [to integer! result] result]&lt;br /&gt;    ]&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Tue, 10 Jan 2006 05:58:35 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1111</guid>
      <author>gregg.irwin (Gregg Irwin)</author>
    </item>
    <item>
      <title>Generic base conversor //Javascript Object</title>
      <link>http://snippets.dzone.com/posts/show/523</link>
      <description>&lt;a href="http://jsfromhell.com/number/base-conversor"&gt;&lt;br /&gt;Minimum Common Multiple&lt;br /&gt;&lt;br /&gt;[UPDATED CODE AND HELP CAN BE FOUND HERE]&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;//+ Jonas Raoni Soares Silva&lt;br /&gt;//@ http://jsfromhell.com/number/base-conversor [v1.0]&lt;br /&gt;&lt;br /&gt;Conversor = {&lt;br /&gt;	h: '0123456789abcdefghijklmnopqrstuvwxyz',&lt;br /&gt;&lt;br /&gt;	int2base: function( n, base ){&lt;br /&gt;		if( base &lt; 2 || base &gt; this.h.length )&lt;br /&gt;			throw new Error( "base inv&#225;lida" );&lt;br /&gt;		for( var n = parseInt( n ) || 0, result = ""; n; result = this.h.charAt( n % base ) + result, n = Math.floor( n / base ) );&lt;br /&gt;		return result;&lt;br /&gt;	},&lt;br /&gt;	base2int: function( s, base ){&lt;br /&gt;		for( var i = -1, l = s.length, result = 0; ++i &lt; l; result = result * base + this.h.indexOf( s.charAt( i ) ) );&lt;br /&gt;		return result;&lt;br /&gt;	}&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Fri, 29 Jul 2005 17:22:24 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/523</guid>
      <author>jonasraoni (Jonas Raoni Soares Silva)</author>
    </item>
  </channel>
</rss>
