Difference between revisions of "Template:In str/doc"
Jump to navigation
Jump to search
(Created page with "<pre> {{In_string |source= |target= |start= |plain= |nomatch= }} </pre> == See Also == * wikipedia:Template:In_string; The source for this template page from Wikipedia") |
|||
Line 1: | Line 1: | ||
Same as <code><nowiki>{{#invoke:String|find|...}}</nowiki></code>, but provides an extra option to return an alternative string. | |||
<pre> | <pre> | ||
{{ | {{In_str | ||
|source= | |source= | ||
|target= | |target= | ||
Line 8: | Line 9: | ||
}} | }} | ||
</pre> | </pre> | ||
== Examples == | |||
{| class="wikitable" | |||
! Wikitext !! Result !! Description | |||
|- | |||
| <pre>{{In_str | |||
|source=Ruby, Fire | |||
|target= Fire | |||
|nomatch= | |||
|plain=true}}</pre> | |||
|{{In_str | |||
|source=Ruby, Fire | |||
|target= Fire | |||
|nomatch= | |||
|plain=true}} | |||
| It returns the position of <code><nowiki>target</nowiki></code> parameter in string. | |||
|- | |||
| <pre>{{#if:{{In_str | |||
|source=Ruby, Fire | |||
|target= Fire | |||
|nomatch= | |||
|plain=true}}|[[File:Debuff_fire.jpg]]|}}</pre> | |||
|{{#if:{{In_str | |||
|source=Ruby, Fire | |||
|target= Fire | |||
|nomatch= | |||
|plain=true}}|[[File:Debuff_fire.jpg]]|}} | |||
| It does an "if condition", if the value is null, this displays an image.<br> In this case, the result matches the condition, and the image is showed. | |||
|- | |||
| <pre>{{#if:{{In_str | |||
|source=Sapphire, Frost | |||
|target= Fire | |||
|nomatch= | |||
|plain=true}}|[[File:Debuff_fire.jpg]]|}}</pre> | |||
|{{#if:{{In_str | |||
|source=Sapphire, Frost | |||
|target= Fire | |||
|nomatch= | |||
|plain=true}}|[[File:Debuff_fire.jpg]]|}} | |||
| Almost the same as above, but the word "Fire" isn't present in the source string.<br>In this case, the condition fails, and the image isn't shown. | |||
|} | |||
== See Also == | == See Also == | ||
* [[wikipedia:Template:In_string]]; The source for this template page from Wikipedia | * [[wikipedia:Template:In_string]]; The source for this [[:Template:In_str|template]] page from Wikipedia |
Latest revision as of 01:20, 18 December 2021
Same as {{#invoke:String|find|...}}
, but provides an extra option to return an alternative string.
{{In_str |source= |target= |start= |plain= |nomatch= }}
Examples
See Also
- wikipedia:Template:In_string; The source for this template page from Wikipedia