https://de.wikipedia.org/w/index.php?action=history&feed=atom&title=Modul%3AString_count Modul:String count - Versionsgeschichte 2025-07-27T12:48:36Z Versionsgeschichte dieser Seite in Wikipedia MediaWiki 1.45.0-wmf.11 https://de.wikipedia.org/w/index.php?title=Modul:String_count&diff=152847039&oldid=prev Krd: 2 Versionen von :en:Module:String_count importiert 2016-03-25T11:08:43Z <p>2 Versionen von <a href="https://en.wikipedia.org/wiki/Module:String_count" class="extiw" title="en:Module:String count">en:Module:String_count</a> importiert</p> <table style="background-color: #fff; color: #202122;" data-mw="interface"> <tr class="diff-title" lang="de"> <td colspan="1" style="background-color: #fff; color: #202122; text-align: center;">← Nächstältere Version</td> <td colspan="1" style="background-color: #fff; color: #202122; text-align: center;">Version vom 25. März 2016, 13:08 Uhr</td> </tr><tr><td colspan="2" class="diff-notice" lang="de"><div class="mw-diff-empty">(kein Unterschied)</div> </td></tr></table> Krd https://de.wikipedia.org/w/index.php?title=Modul:String_count&diff=152847038&oldid=prev Mr. Stradivarius: replace the match as it is found - perhaps this will use up less memory? 2015-03-06T02:19:25Z <p>replace the match as it is found - perhaps this will use up less memory?</p> <table style="background-color: #fff; color: #202122;" data-mw="interface"> <col class="diff-marker" /> <col class="diff-content" /> <col class="diff-marker" /> <col class="diff-content" /> <tr class="diff-title" lang="de"> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Nächstältere Version</td> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Version vom 6. März 2015, 04:19 Uhr</td> </tr><tr> <td colspan="2" class="diff-lineno">Zeile 41:</td> <td colspan="2" class="diff-lineno">Zeile 41:</td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> -- Find the count</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> -- Find the count</div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> local temp, count = mw.ustring.gsub(text, pattern, '')</div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> local temp, count = mw.ustring.gsub(text, pattern, '<ins style="font-weight: bold; text-decoration: none;">%0</ins>')</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> return count</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> return count</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>end</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>end</div></td> </tr> </table> Mr. Stradivarius https://de.wikipedia.org/w/index.php?title=Modul:String_count&diff=152847037&oldid=prev Mr. Stradivarius: create string-counting module based on Module:User:Mr. Stradivarius/String count with additional error checks 2015-03-06T02:17:29Z <p>create string-counting module based on <a href="/w/index.php?title=Modul:User:Mr._Stradivarius/String_count&amp;action=edit&amp;redlink=1" class="new" title="Modul:User:Mr. Stradivarius/String count (Seite nicht vorhanden)">Module:User:Mr. Stradivarius/String count</a> with additional error checks</p> <p><b>Neue Seite</b></p><div>-- This module counts the number of times a string appears on a given page.<br /> <br /> local yesno = require(&#039;Module:Yesno&#039;)<br /> <br /> local p = {}<br /> <br /> local function escapePattern(s)<br /> -- Escape punctuation in a string so it can be used in a Lua pattern.<br /> s = s:gsub(&#039;%p&#039;, &#039;%%%0&#039;)<br /> return s<br /> end<br /> <br /> function p._count(args)<br /> -- Get the page text, checking for common errors.<br /> if not args.page then<br /> error(&quot;no &#039;page&#039; argument; please provide the name of the page you &quot; ..<br /> &quot;wish to count strings in&quot;, 2)<br /> end<br /> local title = mw.title.new(args.page)<br /> if not title then<br /> error(string.format(<br /> &quot;&#039;%s&#039; is not a valid page name; check for invalid characters&quot;,<br /> args.page<br /> ), 2)<br /> end<br /> local text = title:getContent()<br /> if not text then<br /> error(string.format(<br /> &quot;could not get the content of page &#039;%s&#039;; check that it exists&quot;,<br /> title.prefixedText<br /> ), 2)<br /> end<br /> <br /> -- Get the pattern<br /> local pattern = args.search<br /> if not pattern then<br /> error(&quot;no &#039;search&#039; argument; please provide the string you wish to search for&quot;, 2)<br /> elseif yesno(args.plain) ~= false then<br /> pattern = escapePattern(pattern)<br /> end<br /> <br /> -- Find the count<br /> local temp, count = mw.ustring.gsub(text, pattern, &#039;&#039;)<br /> return count<br /> end<br /> <br /> function p.count(frame)<br /> local args = require(&#039;Module:Arguments&#039;).getArgs(frame, {<br /> wrappers = &#039;Template:String count&#039;<br /> })<br /> return p._count(args)<br /> end<br /> <br /> return p</div> Mr. Stradivarius