<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-Hans-CN">
	<id>https://wiki.statsape.com/index.php?action=history&amp;feed=atom&amp;title=%E6%A8%A1%E5%9D%97%3ABaseConvert%2Fdoc</id>
	<title>模块:BaseConvert/doc - 版本历史</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.statsape.com/index.php?action=history&amp;feed=atom&amp;title=%E6%A8%A1%E5%9D%97%3ABaseConvert%2Fdoc"/>
	<link rel="alternate" type="text/html" href="https://wiki.statsape.com/index.php?title=%E6%A8%A1%E5%9D%97:BaseConvert/doc&amp;action=history"/>
	<updated>2026-11-10T15:08:13Z</updated>
	<subtitle>本wiki上该页面的版本历史</subtitle>
	<generator>MediaWiki 1.39.6</generator>
	<entry>
		<id>https://wiki.statsape.com/index.php?title=%E6%A8%A1%E5%9D%97:BaseConvert/doc&amp;diff=4573&amp;oldid=prev</id>
		<title>Zeroclanzhang：​创建页面，内容为“{{High-use}}  Converts numbers to a specified base between 2 and 36, for use in templates such as {{Tl|Binary}}, {{Tl|Octal}}, {{Tl|Hexadecimal}}, etc.  ==Usage== &lt;syntaxhighlight lang=&quot;lua&quot;&gt; local BaseConvert = require(&#039;Module:BaseConvert&#039;) BaseConvert.convert({n = 14600926, base = 16}) -- returns &#039;DECADE&#039; &lt;/syntaxhighlight&gt;  Arguments: *&#039;&#039;&#039;n&#039;&#039;&#039; - (required) the number to be converted, as a string. It may be a number instead, if the input base is 10. *&#039;&#039;&#039;base&#039;…”</title>
		<link rel="alternate" type="text/html" href="https://wiki.statsape.com/index.php?title=%E6%A8%A1%E5%9D%97:BaseConvert/doc&amp;diff=4573&amp;oldid=prev"/>
		<updated>2024-01-16T17:22:18Z</updated>

		<summary type="html">&lt;p&gt;创建页面，内容为“{{High-use}}  Converts numbers to a specified base between 2 and 36, for use in templates such as {{Tl|Binary}}, {{Tl|Octal}}, {{Tl|Hexadecimal}}, etc.  ==Usage== &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt; local BaseConvert = require(&amp;#039;Module:BaseConvert&amp;#039;) BaseConvert.convert({n = 14600926, base = 16}) -- returns &amp;#039;DECADE&amp;#039; &amp;lt;/syntaxhighlight&amp;gt;  Arguments: *&amp;#039;&amp;#039;&amp;#039;n&amp;#039;&amp;#039;&amp;#039; - (required) the number to be converted, as a string. It may be a number instead, if the input base is 10. *&amp;#039;&amp;#039;&amp;#039;base&amp;#039;…”&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{High-use}}&lt;br /&gt;
&lt;br /&gt;
Converts numbers to a specified base between 2 and 36, for use in templates such as {{Tl|Binary}}, {{Tl|Octal}}, {{Tl|Hexadecimal}}, etc.&lt;br /&gt;
&lt;br /&gt;
==Usage==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local BaseConvert = require(&amp;#039;Module:BaseConvert&amp;#039;)&lt;br /&gt;
BaseConvert.convert({n = 14600926, base = 16}) -- returns &amp;#039;DECADE&amp;#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Arguments:&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;n&amp;#039;&amp;#039;&amp;#039; - (required) the number to be converted, as a string. It may be a number instead, if the input base is 10.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;base&amp;#039;&amp;#039;&amp;#039; - (required) the base to which the number should be converted. May be between 2 and 36, inclusive.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;from&amp;#039;&amp;#039;&amp;#039; - the base of the input. Defaults to 10 (or 16 if the input has a leading &amp;#039;0x&amp;#039;). Note that bases other than 10 are not supported if the input has a fractional part.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;precision&amp;#039;&amp;#039;&amp;#039; -  number of digits to be rendered after the radix point. Trailing zeros will be added if needed. If not specified, however many digits are needed will be shown, up to 10.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;width&amp;#039;&amp;#039;&amp;#039; - minimum number of digits to be rendered before the radix point. Leading zeros will be added if needed.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;default&amp;#039;&amp;#039;&amp;#039; - Value to return if n is empty or non-numeric. Defaults to the value of n.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;prefix&amp;#039;&amp;#039;&amp;#039; / &amp;#039;&amp;#039;&amp;#039;suffix&amp;#039;&amp;#039;&amp;#039; - wikitext to add before/after the returned result. Will not be added if n is empty or non-numeric. For example, you might use a prefix of &amp;lt;code&amp;gt;0x&amp;lt;/code&amp;gt; when converting to hex, or a suffix of &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;&amp;lt;sub&amp;gt;8&amp;lt;/sub&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; when converting to octal.&lt;br /&gt;
&lt;br /&gt;
===From templates===&lt;br /&gt;
In wikimarkup, this module may be called with a function name &amp;lt;code&amp;gt;&amp;#039;&amp;#039;n&amp;#039;&amp;#039;to&amp;#039;&amp;#039;m&amp;#039;&amp;#039;&amp;lt;/code&amp;gt;, e.g.:&lt;br /&gt;
&lt;br /&gt;
{{Markup&lt;br /&gt;
|&amp;lt;nowiki&amp;gt;{{#invoke:BaseConvert|16to10|  FF  }}&amp;lt;/nowiki&amp;gt;|{{#invoke:BaseConvert|16to10|  FF  }}&lt;br /&gt;
|&amp;lt;nowiki&amp;gt;{{#invoke:BaseConvert|10to36|500}}&amp;lt;/nowiki&amp;gt;|{{#invoke:BaseConvert|10to36|500}}&lt;br /&gt;
|&amp;lt;nowiki&amp;gt;{{#invoke:BaseConvert|10to16|Foo|default=0}}&amp;lt;/nowiki&amp;gt;|{{#invoke:BaseConvert|10to16|Foo|default=0}}}}&lt;br /&gt;
&lt;br /&gt;
All options above are supported, excluding {{Para|base}}, {{Para|from}} and {{Para|n}} which are set by the mandatory options.&lt;br /&gt;
&lt;br /&gt;
===Edge cases===&lt;br /&gt;
{{Markup&lt;br /&gt;
|&amp;lt;nowiki&amp;gt;{{#invoke:BaseConvert|10to10|500}}&amp;lt;/nowiki&amp;gt;|{{#invoke:BaseConvert|10to10|500}}&lt;br /&gt;
|&amp;lt;nowiki&amp;gt;{{#invoke:BaseConvert|10to10|FooBar}}&amp;lt;/nowiki&amp;gt;|{{#invoke:BaseConvert|10to10|FooBar}}&lt;br /&gt;
|&amp;lt;nowiki&amp;gt;{{#invoke:BaseConvert|10to10|FooBar|default=}}&amp;lt;/nowiki&amp;gt;|{{#invoke:BaseConvert|10to10|FooBar|default=}}&lt;br /&gt;
|&amp;lt;nowiki&amp;gt;{{#invoke:BaseConvert|10to16|Foo}}&amp;lt;/nowiki&amp;gt;|{{#invoke:BaseConvert|10to16|Foo}}}}&lt;br /&gt;
{{Math templates}}&lt;br /&gt;
&amp;lt;includeonly&amp;gt;[[Category:Wikipedia utility modules]]&amp;lt;/includeonly&amp;gt;&amp;lt;noinclude&amp;gt;&lt;br /&gt;
[[pt:Módulo:BaseConvert/doc]]&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Zeroclanzhang</name></author>
	</entry>
</feed>