Module talk:User:Mr. Stradivarius/String count
Add topicMove discussion in progress
[edit]There is a move discussion in progress on Wikipedia talk:Lua which affects this page. Please participate on that page and not in this talk page section. Thank you. —RMCD bot 05:03, 27 December 2018 (UTC)
Basic usage
[edit]This module counts the number of times a string of characters appears in a Wikipedia article – more specifically in the wikitext markup. This makes it possible to also count formatting-related strings such as: <ref> |url |EpisodeNumber.
The following expression will be rendered as an integer corresponding to all occurrences of the string israel in the article about Donald Trump.
{{#invoke:User:Mr. Stradivarius/String count|count|page=Donald Trump|search=israel}}
The |search argument of the count function is case-sensitive. In the above example when searching for the string israel a value of 7 is obtained, searching for Israel yields 14. If the above expression is used within the article that's being analyzed it will also be counted by the script into the grand total string count. The #expr parser function can be used to perform basic arithmetic allowing for the original string count to be displayed in the article. The following expression can be used to perform said arithmetic.
{{#expr:{{#invoke:User:Mr. Stradivarius/String count|count|page=|search=}}-1}}