Index Of (Expression) — Skript

Addon: Skript · Category: Expression · Since: 2.1

Syntax

[the] (|first|last) index of %string% in %string%

Description

The first or last index of a character (or text) in a text, or -1 if it doesn't occur in the text. Indices range from 1 to the <a href='#ExprIndexOf'>length</a> of the text.

Examples

set {_first} to the first index of "@" in the text argument
if {_s} contains "abc":
	set {_s} to the first (index of "abc" in {_s} + 3) characters of {_s} # removes everything after the first "abc" from {_s}

View source