Editing
Module:String/doc
(section)
From Thetacola Wiki
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.
Anti-spam check. Do
not
fill this in!
== str_find == This function duplicates the behavior of {{tl|str_find}}, including all of its quirks. This is provided in order to support existing templates, but is NOT RECOMMENDED for new code and templates. New code is recommended to use the "find" function instead. Returns the first index in "source" that is a match to "target". Indexing is 1-based, and the function returns -1 if the "target" string is not present in "source". Important Note: If the "target" string is empty / missing, this function returns a value of "1", which is generally unexpected behavior, and must be accounted for separately. Usage: : <code><nowiki>{{#invoke:</nowiki>String|str_find|''source_string''|''target_string''}}</code> OR : <code><nowiki>{{#invoke:</nowiki>String|str_find|source= ''source_string'' |target= ''target_string'' }}</code> Parameters: ; source : The string to search ; target : The string to find within source Examples: * <code><nowiki>{{#invoke:String|str_find| abc123def }}</nowiki></code> β {{#invoke:String|str_find| abc123def }} * <code><nowiki>{{#invoke:String|str_find|source= abc123def }}</nowiki></code> β {{#invoke:String|str_find|source= abc123def }} * <code><nowiki>{{#invoke:String|str_find| abc123def |123}}</nowiki></code> β {{#invoke:String|str_find| abc123def |123}} * <code><nowiki>{{#invoke:String|str_find|source= abc123def |target= 123 }}</nowiki></code> β {{#invoke:String|str_find|source= abc123def |target= 123 }} * <code><nowiki>{{#invoke:String|str_find| abc123def |not}}</nowiki></code> β {{#invoke:String|str_find| abc123def |not}}
Summary:
Please note that all contributions to Thetacola 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
Project:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Page actions
Module
Discussion
Read
Edit source
History
Page actions
Module
Discussion
More
Tools
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Search
Tools
What links here
Related changes
Special pages
Page information