Mal:Str find

Fra Wikisida.no
Sideversjon per 12. okt. 2011 kl. 20:14 av nb>Danmichaelo (Ny side: {{#titleparts: {{str find/logic|{{{1|}}}|{{{2|}}}|{{str len|*{{{2|}}}*}}-2}}-1 | 1 }}<noinclude> {{documentation}}</noinclude>)
(diff) ← Eldre sideversjon | Nåværende sideversjon (diff) | Nyere sideversjon → (diff)
Hopp til navigering Hopp til søk

1

Maldokumentasjon


Usage

{{Str find|text|sub_string}} = Position of first appearance of sub_string in text.

  • Only searches first 50 characters of text. Returns -1 if sub_string not found in first 50 characters.
  • Character position is 1 based (not 0 based as usual in calculations).
  • Warning: if sub_string is empty, then this routine will return 1 !!! This case will often have to be handled specially.

See also

  • Template:Strfind short can handle longer strings (<99 chars), and gives far better performance, especially for short strings.