listRange function

Syntax

  • string listRange(stringList, leftIndex, rightIndex)

Parameters

  1. stringListstring
  2. leftIndexfloat
  3. rightIndexfloat

Returns

Returns items from leftIndex to rightIndex (rightIndex excluded).

Description

The listRange function returns all items in the stringList from leftIndex to rightIndex (the rightIndex item is not included in the resulting list).

Note:
  • Indices are 0 - based.
  • 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

listRange("rule;your;city;with;cityengine;",0,3)
# result = "rule;your;city;"
listRange("texture_1;texture_2;texture_3;texture_4;texture_5;texture_6;",2,3)
# result = "texture_3"