listCount function

Syntax

  • string listCount(string stringList, string item)

Returns

Returns number of occurrences of item in stringList. Optional: leading or trailing * in item are used as wildcard.

Description

The listCount function returns the number of occurrences of item in the stringList.

Note:

Stringlists are a series of strings stored inside one string. The elements are separated by a semicolon (";"). Each item must be followed by a semicolon, also the last one! The data type is "string", thus it is not an array as used in other scripting languages.

Related

Examples

example.1
    listCount("rule;your;city;","city")
    # result = 1

example.2
    listCount("city;cityengine;city;", "city")
    # result = 2

example.3
    listCount("rule;your;city;","*y*")
    # result = 2

example.4
    listCount("rule;your;city;","*y")
    # result = 1

In this topic