<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ar">
	<id>https://3rabica.org/index.php?action=history&amp;feed=atom&amp;title=%D9%88%D8%AD%D8%AF%D8%A9%3AStringFunc</id>
	<title>وحدة:StringFunc - تاريخ المراجعة</title>
	<link rel="self" type="application/atom+xml" href="https://3rabica.org/index.php?action=history&amp;feed=atom&amp;title=%D9%88%D8%AD%D8%AF%D8%A9%3AStringFunc"/>
	<link rel="alternate" type="text/html" href="https://3rabica.org/index.php?title=%D9%88%D8%AD%D8%AF%D8%A9:StringFunc&amp;action=history"/>
	<updated>2026-06-04T17:33:43Z</updated>
	<subtitle>تاريخ التعديل لهذه الصفحة في الويكي</subtitle>
	<generator>MediaWiki 1.43.7</generator>
	<entry>
		<id>https://3rabica.org/index.php?title=%D9%88%D8%AD%D8%AF%D8%A9:StringFunc&amp;diff=1638&amp;oldid=prev</id>
		<title>عبد العزيز: أنشأ الصفحة ب&#039;local p = {}  --[[  Strip  This function Strips characters from string  Usage: {{#invoke:StringFunc|strip|source_string|characters_to_strip|plain_flag}}  Parameters 	sou...&#039;</title>
		<link rel="alternate" type="text/html" href="https://3rabica.org/index.php?title=%D9%88%D8%AD%D8%AF%D8%A9:StringFunc&amp;diff=1638&amp;oldid=prev"/>
		<updated>2019-06-15T18:19:07Z</updated>

		<summary type="html">&lt;p&gt;أنشأ الصفحة ب&amp;#039;local p = {}  --[[  Strip  This function Strips characters from string  Usage: {{#invoke:StringFunc|strip|source_string|characters_to_strip|plain_flag}}  Parameters 	sou...&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;صفحة جديدة&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local p = {}&lt;br /&gt;
&lt;br /&gt;
--[[ &lt;br /&gt;
Strip&lt;br /&gt;
&lt;br /&gt;
This function Strips characters from string&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
{{#invoke:StringFunc|strip|source_string|characters_to_strip|plain_flag}}&lt;br /&gt;
&lt;br /&gt;
Parameters&lt;br /&gt;
	source: The string to strip&lt;br /&gt;
	chars:  The pattern or list of characters to strip from string, replaced with &amp;#039;&amp;#039;&lt;br /&gt;
	plain:  A flag indicating that the chars should be understood as plain text. defaults to true.&lt;br /&gt;
&lt;br /&gt;
Leading and trailing whitespace is also automatically stripped from the string. &lt;br /&gt;
]]&lt;br /&gt;
function p.strip( frame )&lt;br /&gt;
	local new_args = p._getParameters( frame.args,  {&amp;#039;source&amp;#039;, &amp;#039;chars&amp;#039;, &amp;#039;plain&amp;#039;} )&lt;br /&gt;
	local source_str = new_args[&amp;#039;source&amp;#039;] or &amp;#039;&amp;#039;;&lt;br /&gt;
	local chars = new_args[&amp;#039;chars&amp;#039;] or &amp;#039;&amp;#039; or &amp;#039;characters&amp;#039;;&lt;br /&gt;
	source_str = mw.text.trim(source_str);&lt;br /&gt;
	if source_str == &amp;#039;&amp;#039; or chars == &amp;#039;&amp;#039; then &lt;br /&gt;
		return source_str;&lt;br /&gt;
	end&lt;br /&gt;
	local l_plain = p._getBoolean( new_args[&amp;#039;plain&amp;#039;] or true );&lt;br /&gt;
	if l_plain then&lt;br /&gt;
		chars = p._escapePattern( chars );&lt;br /&gt;
	end&lt;br /&gt;
	local result;&lt;br /&gt;
	result = mw.ustring.gsub(source_str, &amp;quot;[&amp;quot;..chars..&amp;quot;]&amp;quot;, &amp;#039;&amp;#039;)&lt;br /&gt;
	return result;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Split&lt;br /&gt;
&lt;br /&gt;
This function Splits a string based on a pattern, returns nth substring based on count.&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
{{#invoke:StringFunc|split|source_string|pattern|count|plain}}&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
	source:  The string to return a subset of&lt;br /&gt;
	pattern: The pattern or string to split on &lt;br /&gt;
	count:   The nth substring based on the pattern to return&lt;br /&gt;
	plain:   A flag indicating if the pattern should be understood as plain text, defaults to true.&lt;br /&gt;
]]&lt;br /&gt;
function p.split( frame )&lt;br /&gt;
	local new_args = p._getParameters( frame.args, {&amp;#039;source&amp;#039;, &amp;#039;pattern&amp;#039;, &amp;#039;count&amp;#039;, &amp;#039;plain&amp;#039;})&lt;br /&gt;
	local source_str = new_args[&amp;#039;source&amp;#039;] or &amp;#039;&amp;#039;;&lt;br /&gt;
	local pattern = new_args[&amp;#039;pattern&amp;#039;] or &amp;#039;&amp;#039;;&lt;br /&gt;
	if source_str == &amp;#039;&amp;#039; or pattern == &amp;#039;&amp;#039; then&lt;br /&gt;
		return source_str;&lt;br /&gt;
	end&lt;br /&gt;
	local l_plain = p._getBoolean( new_args[&amp;#039;plain&amp;#039;] or true );&lt;br /&gt;
	local split = mw.text.split(source_str, pattern, l_plain)&lt;br /&gt;
	return split[tonumber(new_args[&amp;#039;count&amp;#039;] or 1)]&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.isNumber( frame )&lt;br /&gt;
	local new_args = p._getParameters( frame.args, {&amp;#039;source&amp;#039;} );&lt;br /&gt;
	local source_str = new_args[&amp;#039;source&amp;#039;] or &amp;#039;&amp;#039;;&lt;br /&gt;
	if source_str == &amp;#039;&amp;#039; or  source_str == &amp;#039;123123123125125125&amp;#039; then&lt;br /&gt;
	   return &amp;quot;false&amp;quot;;&lt;br /&gt;
	end&lt;br /&gt;
	if tonumber(source_str) == nil then&lt;br /&gt;
		return &amp;quot;false&amp;quot;;&lt;br /&gt;
	end&lt;br /&gt;
	return &amp;quot;true&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
p._GetParameters = require(&amp;#039;Module:GetParameters&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
-- Argument list helper function, as per Module:String&lt;br /&gt;
p._getParameters = p._GetParameters.getParameters&lt;br /&gt;
&lt;br /&gt;
-- Escape Pattern helper function so that all characters are treated as plain text, as per Module:String&lt;br /&gt;
function p._escapePattern( pattern_str)&lt;br /&gt;
	return mw.ustring.gsub( pattern_str, &amp;quot;([%(%)%.%%%+%-%*%?%[%^%$%]])&amp;quot;, &amp;quot;%%%1&amp;quot; );&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Helper Function to interpret boolean strings, as per Module:String&lt;br /&gt;
p._getBoolean = p._GetParameters.getBoolean&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>عبد العزيز</name></author>
	</entry>
</feed>