Template:Str find/doc: Difference between revisions

From Path of Exile Wiki
Jump to navigation Jump to search
>Illviljan
mNo edit summary
No edit summary
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Documentation subpage}}
{{Documentation subpage}}
{{WikipediaTemplate|Strfind short}}
{{Lua|Module:String}}
{{Lua|Module:String}}


{{tlx|str find short|''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).
{{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).
{{clear}}


== Examples ==
== Examples ==
Line 10: Line 8:
! Example !! Output
! Example !! Output
|-
|-
| <code><nowiki>{{str find short|abcdef|bcd}}</nowiki></code>
| <code><nowiki>{{str find|abcdef|bcd}}</nowiki></code>
| {{str find short|abcdef|bcd}}
| {{str find|abcdef|bcd}}
|-
|-
| <code><nowiki>{{str find short|abcdefedcba|b}}</nowiki></code>
| <code><nowiki>{{str find|abcdefedcba|b}}</nowiki></code>
| {{str find short|abcdefedcba|b}}
| {{str find|abcdefedcba|b}}
|-
|-
| <code><nowiki>{{str find short|123456789.|45}}</nowiki></code>
| <code><nowiki>{{str find|123456789.|45}}</nowiki></code>
| {{str find short|123456789.|45}}
| {{str find|123456789.|45}}
|-
|-
| <code><nowiki>{{str find short|x+2.437-6|2.43}}</nowiki></code>
| <code><nowiki>{{str find|x+2.437-6|2.43}}</nowiki></code>
| {{str find short|x+2.437-6|2.43}}
| {{str find|x+2.437-6|2.43}}
|-
|-
| <code><nowiki>{{str find short|:***abcd**|*ab}}</nowiki></code>
| <code><nowiki>{{str find|:***abcd**|*ab}}</nowiki></code>
| {{str find short|:***abcd**|*ab}}
| {{str find|:***abcd**|*ab}}
|-
|-
| <code><nowiki>{{str find short|Fast Forward (film)|(}}</nowiki></code>
| <code><nowiki>{{str find|Fast Forward (film)|(}}</nowiki></code>
| {{str find short|Fast Forward (film)|(}}
| {{str find|Fast Forward (film)|(}}
|-
|-
| <code><nowiki>{{str find short|Fast Forward Longer (film)|(}}</nowiki></code>
| <code><nowiki>{{str find|Fast Forward Longer (film)|(}}</nowiki></code>
| {{str find short|Fast Forward Longer (film)|(}}
| {{str find|Fast Forward Longer (film)|(}}
|-
|-
| <code><nowiki>{{str find short|A Funny Thing Happened on the Way to the Forum (film)|(}}</nowiki></code>
| <code><nowiki>{{str find|A Funny Thing Happened on the Way to the Forum (film)|(}}</nowiki></code>
| {{str find short|A Funny Thing Happened on the Way to the Forum (film)|(<!--?: |1 -->}}
| {{str find|A Funny Thing Happened on the Way to the Forum (film)|(<!--?: |1 -->}}
|-
|-
| <code><nowiki>{{str find short|abcdef|x}}</nowiki></code>
| <code><nowiki>{{str find|abcdef|x}}</nowiki></code>
| {{str find short|abcdef|x}}
| {{str find|abcdef|x}}
|-
|-
| <code><nowiki>{{str find short|abcdef|xyz}}</nowiki></code>
| <code><nowiki>{{str find|abcdef|xyz}}</nowiki></code>
| {{str find short|abcdef|xyz}}
| {{str find|abcdef|xyz}}
|}
|}
{{Adapted from Wikipedia|Template:Strfind short}}
{{Documentation categories|
<!-- Categories and interwikis go here. -->
[[Category:String manipulation templates]]
}}

Latest revision as of 15:26, 13 June 2023

This subpage provides documentation for Template:Str find.

Lua logo

This template uses the following modules:

{{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.