Skip to main content
Version: Next

Index Of

Gets the position of a string inside another one.

Description

Gets the position of string s2 in string s1. The index starts at zero, and is set to -1 if the substring is not present.

Inputs

  • s1 (String): The string to search in.
  • s2 (String): The substring to search for.

Outputs

  • s1.indexOf(s2) (Number): The index.