token_string_item

Declaration

token_string_item (tokens, delimiter: STRING; index: INTEGER): STRING

Description

Returns the delimiter-separated token at position index (which is 1-based) in tokens. Useful for writing loops with token_string_count that work on each item in a tokenized string. Only uses the first character of delimiter.

See Also

sort_token_string
token_string_count
string functions

Example

script build_report is
  num_profiles := token_string_count (profile_names, ',')
  i := 1;
  while i < num_profiles loop
    prof_name := token_string_item (profile_names, ',', i)
    load_profile_vars (prof_name)
    -- do something with the variables
    i := i + 1
  end
end