v50 Steam/Premium information for editors
- v50 information can now be added to pages in the main namespace. v0.47 information can still be found in the DF2014 namespace. See here for more details on the new versioning policy.
- Use this page to report any issues related to the migration.
This notice may be cached—the current version can be found here.
Difference between revisions of "Template:Str/len"
Jump to navigation
Jump to search
m (Allow all characters (use \w\W instead of . )) |
m (whoops) |
||
Line 1: | Line 1: | ||
− | <includeonly>{{#vardefine:strlen|0}}{{#eval:{{#rreplace:{{{1|}}}|\w\W|{{#delay:#vardefine:strlen|{{#delay:#expr:{{#delay:#var:strlen}}+1}}}}}}}}{{#var:strlen}}</includeonly><noinclude> | + | <includeonly>{{#vardefine:strlen|0}}{{#eval:{{#rreplace:{{{1|}}}|[\w\W]|{{#delay:#vardefine:strlen|{{#delay:#expr:{{#delay:#var:strlen}}+1}}}}}}}}{{#var:strlen}}</includeonly><noinclude> |
{{documentation}} | {{documentation}} | ||
</noinclude> | </noinclude> |
Revision as of 00:18, 25 June 2013
(view - edit - history - purge) Documentation
Calculates length of {{{1}}}.
Examples
{{str/len|abc}}
→ 3
{{str/len|Dwarf Fortress}}
→ 14
{{str/len|a b}}
→ 3
Caveats
{{str/len|<nowiki/>}}
→ 34
This is due to MediaWiki's implementation of <nowiki> — <nowiki> tags are replaced with an identifier when parsed. For example, <nowiki>text</nowiki>
becomes '"`UNIQ--nowiki-00000006-QINU`"'
. (Note that purging this page will display a different token, despite the contents being the same.)