Шаблон:Str find0/док — разлика између измена

Iz Vojne Enciklopedije
Пређи на навигацију Пређи на претрагу
[непроверена измена][непроверена измена]
(+)
 
м (1 измена увезена)
 
(нема разлике)

Тренутна верзија на датум 5. фебруар 2021. у 13:28

Lua error: Cannot create process: proc_open(/dev/null): failed to open stream: Operation not permitted Lua error: Cannot create process: proc_open(/dev/null): failed to open stream: Operation not permitted

The Template:str_find0 returns first appearance of a substring in a string, otherwise returns -1.
This template uses sub-template:str sub find which does the routine.

Usage

{{str find0|<string1>|<string2>}}

  • It is zero-based. So no need for extra {{#expr:{{str find|}}-1}} calculations to use it in other templates.

Limitations

  • Handles strings up to 90 characters.

Performance

  • Very fast on short strings. Uses enhanced algorithm to run the subroutine only when needed.

Examples

  • {{str find0|abcdef|abc}} → Грешка у изразу: неочекивани оператор „<“
  • {{str find0|abcdef|def}} → Грешка у изразу: неочекивани оператор „<“
  • {{str find0|abcdef|ghi}} → Грешка у изразу: неочекивани оператор „<“
  • {{str find0|abcdef|abcdefghi}} → Грешка у изразу: неочекивани оператор „<“

See also


Lua error: Cannot create process: proc_open(/dev/null): failed to open stream: Operation not permitted