Template:Str find/doc: Difference between revisions
Jump to navigation
Jump to search
m (Vinifera7 moved page Template:Str find short/doc to Template:Str find/doc without leaving a redirect: Leaving no redirect from old name, since this template is currently unused) |
No edit summary |
||
Line 1: | Line 1: | ||
{{Documentation subpage}} | {{Documentation subpage}} | ||
{{Lua|Module:String}} | {{Lua|Module:String}} | ||
{{tlx|str find | {{tlx|str find|''target''|''string''}} outputs the position in ''target'' where ''string'' first appears (e.g. an output of "3" would mean beginning at the third character in ''target''). If ''string'' is not found, it outputs zero (0). | ||
== Examples == | == Examples == | ||
Line 10: | Line 8: | ||
! Example !! Output | ! Example !! Output | ||
|- | |- | ||
| <code><nowiki>{{str find | | <code><nowiki>{{str find|abcdef|bcd}}</nowiki></code> | ||
| {{str find | | {{str find|abcdef|bcd}} | ||
|- | |- | ||
| <code><nowiki>{{str find | | <code><nowiki>{{str find|abcdefedcba|b}}</nowiki></code> | ||
| {{str find | | {{str find|abcdefedcba|b}} | ||
|- | |- | ||
| <code><nowiki>{{str find | | <code><nowiki>{{str find|123456789.|45}}</nowiki></code> | ||
| {{str find | | {{str find|123456789.|45}} | ||
|- | |- | ||
| <code><nowiki>{{str find | | <code><nowiki>{{str find|x+2.437-6|2.43}}</nowiki></code> | ||
| {{str find | | {{str find|x+2.437-6|2.43}} | ||
|- | |- | ||
| <code><nowiki>{{str find | | <code><nowiki>{{str find|:***abcd**|*ab}}</nowiki></code> | ||
| {{str find | | {{str find|:***abcd**|*ab}} | ||
|- | |- | ||
| <code><nowiki>{{str find | | <code><nowiki>{{str find|Fast Forward (film)|(}}</nowiki></code> | ||
| {{str find | | {{str find|Fast Forward (film)|(}} | ||
|- | |- | ||
| <code><nowiki>{{str find | | <code><nowiki>{{str find|Fast Forward Longer (film)|(}}</nowiki></code> | ||
| {{str find | | {{str find|Fast Forward Longer (film)|(}} | ||
|- | |- | ||
| <code><nowiki>{{str find | | <code><nowiki>{{str find|A Funny Thing Happened on the Way to the Forum (film)|(}}</nowiki></code> | ||
| {{str find | | {{str find|A Funny Thing Happened on the Way to the Forum (film)|(<!--?: |1 -->}} | ||
|- | |- | ||
| <code><nowiki>{{str find | | <code><nowiki>{{str find|abcdef|x}}</nowiki></code> | ||
| {{str find | | {{str find|abcdef|x}} | ||
|- | |- | ||
| <code><nowiki>{{str find | | <code><nowiki>{{str find|abcdef|xyz}}</nowiki></code> | ||
| {{str find | | {{str find|abcdef|xyz}} | ||
|} | |} | ||
Latest revision as of 15:26, 13 June 2023
This subpage provides documentation for Template:Str find.
{{str find|target|string}}
outputs the position in target where string first appears (e.g. an output of "3" would mean beginning at the third character in target). If string is not found, it outputs zero (0).
Examples
Example | Output |
---|---|
{{str find|abcdef|bcd}}
|
2 |
{{str find|abcdefedcba|b}}
|
2 |
{{str find|123456789.|45}}
|
4 |
{{str find|x+2.437-6|2.43}}
|
3 |
{{str find|:***abcd**|*ab}}
|
4 |
{{str find|Fast Forward (film)|(}}
|
14 |
{{str find|Fast Forward Longer (film)|(}}
|
21 |
{{str find|A Funny Thing Happened on the Way to the Forum (film)|(}}
|
48 |
{{str find|abcdef|x}}
|
0 |
{{str find|abcdef|xyz}}
|
0 |
This template was adapted from Template:Strfind short on Wikipedia.
Adaptation is noted for reference and attribution only. This template may differ from the original in function or in usage.
Adaptation is noted for reference and attribution only. This template may differ from the original in function or in usage.