Editing
Template:Str sub old/doc
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
The edit appears to have already been undone.
Anti-spam check. Do
not
fill this in!
{{Documentation subpage}} {{Lua|Module:String}} <!----PLEASE ADD CATEGORIES WHERE INDICATED AT THE BOTTOM OF THIS PAGE----> == Usage == <code><nowiki>{{str sub old|</nowiki>''text''|''start''|''length''<nowiki>}}</nowiki></code> = Substring of ''text'' starting at ''start'' and containing ''length'' characters. Zero-indexed: the first character is numbered 0, and so on, e.g. <nowiki>{{str sub old|20090624130510|8|2}}</nowiki> returns the 2 characters starting at the 9th, i.e. "{{str sub old|20090624130510|8|2}}". ==Examples== * <nowiki>{{str sub old|1234567|3|2}}</nowiki> {{nowrap|—> {{str sub old|1234567|3|2}} }} * <nowiki>{{str sub old| alphabet|0|5}}</nowiki> {{nowrap|—> {{str sub old| alphabet|0|5}} }} * <nowiki>{{str sub old| alphabet|5|999}}</nowiki> {{nowrap|—> {{str sub old |alphabet|5|999}} }} * <nowiki>{{str sub old|alph abet|0|5}}</nowiki> {{nowrap|—> {{str sub old|alph abet|0|5}} }} * <nowiki>{{str sub old| three words here |4|10}}</nowiki> {{nowrap|—> {{str sub old| three words here |4|10}} }} Any leading spaces are skipped, but internal spaces are counted exactly, yet compressed when displayed. == Template data == {{TemplateData header}} <templatedata> { "description": "The template takes a substring of ''text'' starting at ''start'' and containing ''length'' characters.", "params": { "1": { "label": "Text", "description": "The substring to be trimmed.", "type": "string", "required": true }, "2": { "label": "Numeric position", "description": "Numeric position of the starting character within the string", "type": "number", "required": true }, "3": { "label": "Count", "description": "Number of characters for the substring", "type": "number", "required": true } } } </templatedata> {{En-WP attribution notice}} <includeonly>{{Sandbox other|| <!----CATEGORIES BELOW THIS LINE, PLEASE:----> [[Category:String manipulation templates]] }}</includeonly>
Summary:
Please note that all contributions to Meta Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Meta Wiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Dark mode
Contributions
Create account
Log in
Namespaces
Template
Discussion
English
Views
Read
Edit source
View history
More
Purge
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
What links here
Related changes
Special pages
Page information
Get shortened URL