Open main menu
Home
Random
Donate
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:String/doc
(section)
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 Stockhub 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
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)