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

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

In this topic