find function

Syntax

  • float find(inputString, matchString, n)

Parameters

  1. inputStringstring
  2. matchStringstring
  3. nfloat

Returns

Index of nth occurrence of matchString in inputString or -1 if not found.

Description

The find function returns the index of the of the nth occurrence of the matchString in the inputString.

Note:

Index n is 0-based.

Related

Examples

find("CE_Zero CE_One CE_Two", "CE", 0)
# result = 0
find("CE_Zero CE_One CE_Two", "CE", 1)
# result = 8
find("cityengine rocks my world; cityengine should rock yours too", "cityengine", 0)
# result = 0
find("cityengine rocks my world; cityengine should rock yours too", "cityengine", 1)
# result = 27
find("CE_Zero CE_One CE_Two", "asdf", 1)
# result = -1
# no match found.