Split

The Split function splits a string on a specified separator substring and returns a string collection.

<collection>string Split(
  string source,
  string separator
);

Parameters

  • source
    The string to split.
  • separator
    The substring value to split source on.

Return Values

Returns a collection of string values. Use the foreach keyword to iterate through the collection. If the supplied separator substring was not found, or if the empty string was provided as the separator, this function will return the original string value as the single element in the collection.

Example Code

The following code example splits a URI on the "@" (at) symbol, returning the username as the first element in the collection and the hostname as the second.

foreach (userAndHost in Split(GetUri(sipRequest.From), "@"))) { ... }