Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Humanipedia
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Module:String/doc
(section)
Module
Discussion
English
Read
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit source
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
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.
Anti-spam check. Do
not
fill this in!
== sub == This function returns a substring of the target string at specified inclusive, one-indexed indices. Usage: : <code><nowiki>{{#invoke:</nowiki>String|sub|''target_string''|''start_index''|''end_index''}}</code> OR : <code><nowiki>{{#invoke:</nowiki>String|sub|s= ''target_string'' |i= ''start_index'' |j= ''end_index'' }}</code> Parameters: ; s : The string to return a subset of ; i : The first index of the substring to return, defaults to 1. ; j : The last index of the string to return, defaults to the last character. The first character of the string is assigned an index of 1. If either i or j is a negative value, it is interpreted the same as selecting a character by counting from the end of the string. Hence, a value of -1 is the same as selecting the last character of the string. If the requested indices are out of range for the given string, an error is reported. To avoid error messages, use {{ml|ustring|sub}} instead. Examples: * <code><nowiki>"{{#invoke:String|sub| abcdefghi }}"</nowiki></code> β "{{#invoke:String|sub| abcdefghi }}" * <code><nowiki>"{{#invoke:String|sub|s= abcdefghi }}"</nowiki></code> β "{{#invoke:String|sub|s= abcdefghi }}" * <code><nowiki>"{{#invoke:String|sub| abcdefghi | 3 }}"</nowiki></code> β "{{#invoke:String|sub| abcdefghi | 3 }}" * <code><nowiki>"{{#invoke:String|sub|s= abcdefghi |i= 3 }}"</nowiki></code> β "{{#invoke:String|sub|s= abcdefghi |i= 3 }}" * <code><nowiki>"{{#invoke:String|sub| abcdefghi | 3 | 4 }}"</nowiki></code> β "{{#invoke:String|sub| abcdefghi | 3 | 4 }}" * <code><nowiki>"{{#invoke:String|sub|s= abcdefghi |i= 3 |j= 4 }}"</nowiki></code> β "{{#invoke:String|sub|s= abcdefghi |i= 3 |j= 4 }}"
Summary:
Please note that all contributions to Humanipedia 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
Humanipedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)