find 函数

语法

  • float find(inputString, matchString, n)

参数

  1. inputString - 字符串
  2. matchString - 字符串
  3. n - 浮点型

返回值

matchStringinputString 中第 n 次出现的索引;或 -1(如果未找到)。

说明

find 函数将返回 matchStringinputString 中第 n 次出现的索引。

注:

索引 n 从 0 开始。

相关内容

示例

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.

在本主题中