<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="az">
	<id>https://www.aze.wiki/wiki/index.php?action=history&amp;feed=atom&amp;title=Modul%3AMath%2Ftonumber</id>
	<title>Modul:Math/tonumber - Redaktə tarixçəsi</title>
	<link rel="self" type="application/atom+xml" href="https://www.aze.wiki/wiki/index.php?action=history&amp;feed=atom&amp;title=Modul%3AMath%2Ftonumber"/>
	<link rel="alternate" type="text/html" href="https://www.aze.wiki/wiki/index.php?title=Modul:Math/tonumber&amp;action=history"/>
	<updated>2026-11-16T22:59:57Z</updated>
	<subtitle>AZE.WIKI-də bu səhifənin dəyişikliklər tarixçəsi</subtitle>
	<generator>MediaWiki 1.42.3</generator>
	<entry>
		<id>https://www.aze.wiki/wiki/index.php?title=Modul:Math/tonumber&amp;diff=110&amp;oldid=prev</id>
		<title>WikiSysop: Səhifəni &#039;--  This module convert strings to numbers.   local p = {}  -- Get first integer number from string. function p.integer( frame )     local s = frame.args[1]  	s = stri...&#039; ilə yarat</title>
		<link rel="alternate" type="text/html" href="https://www.aze.wiki/wiki/index.php?title=Modul:Math/tonumber&amp;diff=110&amp;oldid=prev"/>
		<updated>2020-03-08T17:46:23Z</updated>

		<summary type="html">&lt;p&gt;Səhifəni &amp;#039;--&lt;a href=&quot;/wiki/index.php?title=This_module_convert_strings_to_numbers.&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;This module convert strings to numbers. (səhifə mövcud deyil)&quot;&gt;This module convert strings to numbers.  &lt;/a&gt; local p = {}  -- Get first integer number from string. function p.integer( frame )     local s = frame.args[1]  	s = stri...&amp;#039; ilə yarat&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Yeni səhifə&lt;/b&gt;&lt;/p&gt;&lt;div&gt;--[[&lt;br /&gt;
&lt;br /&gt;
This module convert strings to numbers.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
-- Get first integer number from string.&lt;br /&gt;
function p.integer( frame )&lt;br /&gt;
    local s = frame.args[1]&lt;br /&gt;
&lt;br /&gt;
	s = string.gsub( s, &amp;#039;&amp;lt;[^&amp;lt;&amp;gt;]+&amp;gt;&amp;#039;, &amp;#039;&amp;#039; ) -- strip HTML tags&lt;br /&gt;
    s = string.gsub( s, &amp;#039;[^0-9]&amp;#039;, &amp;#039; &amp;#039; )&lt;br /&gt;
    s = mw.text.trim( s )&lt;br /&gt;
    s = mw.text.split( s, &amp;#039; &amp;#039; )[1]&lt;br /&gt;
    &lt;br /&gt;
    return tonumber( s )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Get number from quantity (e.g. from Wikidata).&lt;br /&gt;
function p.quantity( frame )&lt;br /&gt;
	local s = frame.args[1]&lt;br /&gt;
&lt;br /&gt;
	s = string.gsub( s, &amp;#039;&amp;lt;[^&amp;lt;&amp;gt;]+&amp;gt;&amp;#039;, &amp;#039;&amp;#039; ) -- strip HTML tags&lt;br /&gt;
    s = string.gsub( s, &amp;#039; &amp;#039;, &amp;#039;&amp;#039; )&lt;br /&gt;
&lt;br /&gt;
    s = string.gsub( s, &amp;#039;min&amp;#039;, &amp;#039;000&amp;#039; )&lt;br /&gt;
    s = string.gsub( s, &amp;#039;mln&amp;#039;, &amp;#039;000000&amp;#039; )&lt;br /&gt;
    s = string.gsub( s, &amp;#039;mlrd&amp;#039;, &amp;#039;000000000&amp;#039; )&lt;br /&gt;
&lt;br /&gt;
    s = string.gsub( s, &amp;#039;,(%d%d%d)000&amp;#039;, &amp;#039;%1&amp;#039; )&lt;br /&gt;
    s = string.gsub( s, &amp;#039;,(%d%d)000&amp;#039;, &amp;#039;%10&amp;#039; )&lt;br /&gt;
    s = string.gsub( s, &amp;#039;,(%d)000&amp;#039;, &amp;#039;%100&amp;#039; )&lt;br /&gt;
&lt;br /&gt;
    s = string.gsub( s, &amp;#039;±.*$&amp;#039;, &amp;#039;&amp;#039; )&lt;br /&gt;
&lt;br /&gt;
    s = string.gsub( s, &amp;#039;[^0-9]&amp;#039;, &amp;#039; &amp;#039; )&lt;br /&gt;
    s = mw.text.trim( s )&lt;br /&gt;
&lt;br /&gt;
    s = mw.text.split( s, &amp;#039; &amp;#039; )[1]&lt;br /&gt;
&lt;br /&gt;
    return tonumber( s )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Get year value from string.&lt;br /&gt;
function p.year( frame )&lt;br /&gt;
    local n = nil&lt;br /&gt;
    local cat = frame.args[&amp;#039;cat&amp;#039;]&lt;br /&gt;
&lt;br /&gt;
	-- &amp;#039;году&amp;#039; or &amp;#039;года&amp;#039;&lt;br /&gt;
    local yearForm = &amp;#039;il&amp;#039;&lt;br /&gt;
    if frame.args[&amp;#039;form&amp;#039;] and frame.args[&amp;#039;form&amp;#039;] ~= &amp;#039;&amp;#039; then&lt;br /&gt;
    	yearForm = frame.args[&amp;#039;form&amp;#039;]&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
    local s = frame.args[1]&lt;br /&gt;
	s = string.gsub( s, &amp;#039;&amp;lt;[^&amp;lt;&amp;gt;]+&amp;gt;&amp;#039;, &amp;#039;&amp;#039; ) -- strip HTML tags&lt;br /&gt;
&lt;br /&gt;
    local isBce = string.match( s, &amp;#039;e.ə&amp;#039; )&lt;br /&gt;
    s = string.gsub( s, &amp;#039;e.ə&amp;#039;, &amp;#039;&amp;#039; )&lt;br /&gt;
    s = string.gsub( s, &amp;#039;e.ə&amp;#039;, &amp;#039;&amp;#039; )&lt;br /&gt;
&lt;br /&gt;
	-- Get first 3- or 4-digit integer number from string.&lt;br /&gt;
    local sParts = string.gsub( s, &amp;#039;[^0-9]&amp;#039;, &amp;#039; &amp;#039; )&lt;br /&gt;
    sParts = mw.text.trim( sParts )&lt;br /&gt;
    sParts = mw.text.split( sParts, &amp;#039; +&amp;#039; )&lt;br /&gt;
    for k = #sParts, 1, -1 do&lt;br /&gt;
	    v = sParts[k]&lt;br /&gt;
        if string.match( v, &amp;#039;^[12]%d%d%d$&amp;#039; ) then&lt;br /&gt;
            n = tonumber( v )&lt;br /&gt;
            break&lt;br /&gt;
        end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- The entire string is a number.&lt;br /&gt;
	if not n then&lt;br /&gt;
	    s = string.gsub( s, &amp;#039;[%[%]]&amp;#039;, &amp;#039;&amp;#039; )&lt;br /&gt;
	    s = mw.text.trim( s )&lt;br /&gt;
		if string.match( s, &amp;#039;^%d%d?%d?%d?$&amp;#039; ) then&lt;br /&gt;
			n = tonumber( s )&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Generate category&lt;br /&gt;
	if n then&lt;br /&gt;
	    if isBce then&lt;br /&gt;
	    	if cat then&lt;br /&gt;
	    		return &amp;#039;[[К:&amp;#039; .. cat .. &amp;#039; e.ə &amp;#039; .. n .. &amp;#039; &amp;#039; .. yearForm .. &amp;#039; ]]&amp;#039;&lt;br /&gt;
	    	end&lt;br /&gt;
	    	n = -n&lt;br /&gt;
	    else&lt;br /&gt;
	    	if cat then &lt;br /&gt;
	    		return &amp;#039;[[К:&amp;#039; .. cat .. &amp;#039; &amp;#039; .. n .. &amp;#039; &amp;#039; .. yearForm .. &amp;#039;]]&amp;#039;&lt;br /&gt;
	    	end&lt;br /&gt;
	    end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
    return n or frame.args[&amp;#039;default&amp;#039;]&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
</feed>