Template:Monthly clean-up category/monthname/sandbox: Difference between revisions
Appearance
Content deleted Content added
Removed tag for "Wikipedia formatting and function templates" category so that this sandbox page does not appear there. |
Sync with main template Tag: Replaced |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{#switch:{{lc:{{#invoke:string|replace|{{{1}}}|.*[ _]from[ _](...).*|%1|plain=0}}}} |
|||
{{#Switch:{{lc:{{Str left|{{Str right|{{{1|<noinclude>Cleanup from July 2012</noinclude>}}}|{{#expr:{{Strfind short|{{{1|<noinclude>Cleanup from July 2012</noinclude>}}}| from|5|lenstr=80}}+5}} }} |3}}}} |
|||
|jan=January |
|jan=January |
||
|feb=February |
|feb=February |
||
Line 14: | Line 14: | ||
|00 |
|00 |
||
}}<noinclude> |
}}<noinclude> |
||
⚫ | |||
<br>The '''[[Template:Monthly_clean-up_category/monthname]]''' returns the capitalized month name for the 3-letter month prefix (such as "Jan"), as found after the spaced-word " from" in the category title. |
|||
Example: |
|||
* {{Tlx|Monthly clean up category/monthname|Cleanup pages from February 2009}} |
|||
: Result: {{Monthly clean up category/monthname|Cleanup pages from February 2009}} |
|||
If there is no recognized month prefix (after the word " from"), then the string "00" is returned. |
|||
; Performance considerations |
|||
This template searches the text in parameter 1 for the word " from" by using efficient [[Template:Strfind_short]], which runs in 9 levels of expansion depth, plus using {Str_right} for a total of 22 levels, compared to Template:Str_find_long, which runs with 23 levels of depth plus {Str_right} for a total of 35 levels, as used prior to 29 August 2012. |
|||
⚫ |
Latest revision as of 22:21, 26 November 2021
00
This is the template sandbox page for Template:Monthly clean-up category/monthname (diff). |
This template is used on approximately 17,000 pages and changes may be widely noticed. Test changes in the template's /sandbox or /testcases subpages, or in your own user subpage. Consider discussing changes on the talk page before implementing them. |
{{Monthly clean-up category/monthname}} returns the capitalized month name for the 3-letter month prefix (such as "Jan"), as found after the spaced-word " from" in the category title.
Usage
[edit]Example:
{{Monthly clean-up category/monthname|Cleanup pages from February 2009}}
- Result: February
{{Monthly clean-up category/monthname|Cleanup_pages_from_july_2021}}
- Result: July
{{Monthly clean-up category/monthname|Cleanup_pages from 2020}}
- Result: 00
If there is no recognized month prefix (after the word " from"), then the string "00" is returned.