String Collection Object

The string collection object represents an array of text values and includes functions to select items in the array.

Properties

Name Description Return Type Usage Example
Count Returns number of items in collection Integer $Utils.GetString("a,b,c").Split(",").Count$ 3

Functions

Name and Parameters Description Return Type Usage Example
Any(string operator, string value, bool ignoreCase) Returns true if any item in the collection matches the value using the given operator. See list of valid operators below. Boolean $Utils.GetString("a,b,c").Split(",", true).Any(Equals, "b").$ True
First() Gets first item from the collection String $Utils.GetString("a,b,c").Split(",").First()$ "a"
First(string operator, string value, bool ignoreCase) Gets first matching item from the collection using given operator. See list of valid operators below. String $Utils.GetString("library.cs ,utility.js, library.js").Split(",", true).First(EndsWith, ".js")$ "utility.js"
IsEmpty() Returns true if there are no items in the collection Boolean $Utils.GetString("").Split(",").IsEmpty()$ True
Item(integer index) Gets an item in the collection by zero-based index number String $Utils.GetString("a,b,c").Split(",").Item(1)$ "b"
Join(string separator [, string quoteType, bool trimWhitespace, bool removeEmptyEntries]) Concatenates all the items in a string collection, using the specified separator between each item.

The optional quoteType parameter can be "single", "double" or "none" and is used to delimit each item.
String $Utils.GetString("a,b,c").Split(",").Join(" ")$

$Utils.GetString("stage 1, stage 2, stage 3").Split("," ).Join(":", single, true)$
"a b c"

"'stage 1':'stage 2':'stage 3'"
Last() Gets last item from the collection String $Utils.GetString("a,b,c").Split(",").Last()$ "c"
Last(string operator, string value, bool ignoreCase) Gets last matching item from the collection using given operator. See list of valid operators below. String $Utils.GetString("utility.js, library.js, library.cs").Split(",", true).Last(EndsWith, ".js")$ "library.js"
Where(string operator, string value, bool ignoreCase) Gets matching items from the collection using given operator. See list of valid operators below. String Collection $Utils.GetString("utility.js, library.js, library.cs").Split(",", true).Where(StartsWith, "lib").Item(1)$ "library.cs"

Operators

  • Equals
  • DoesNotEqual
  • Contains
  • DoesNotContain
  • StartsWith
  • DoesNotStartWith
  • EndsWith
  • DoesNotEndWith
  • IsRegexMatch
  • IsNotRegexMatch