Name

splitstring — Split a string

Synopsis

list<string> splitstring ( string  STR ,
  string  DELIM );

Parameters

string STR

string DELIM

Return

list<string>

Description

Splits STR into sub-strings at delimiter chars DELIM. the resulting pieces do not contain DELIM

If STR starts with DELIM, the first string in the result list is empty If STR ends with DELIM, the last string in the result list is empty. If STR does not contain DELIM, the result is a singleton list with STR.

Usage

  splitstring ("/abc/dev/ghi", "/") -> ["", "abc", "dev", "ghi" ]
  splitstring ("abc/dev/ghi/", "/") -> ["abc", "dev", "ghi", "" ]
  splitstring ("abc/dev/ghi/", ".") -> ["abc/dev/ghi/" ]
  splitstring ("text/with:different/separators", "/:") -> ["text", "with", "different", "separators"]