SPLIT
The SPLIT
function is used to break a string into multiple strings based on a specified delimiter.
Syntax
string SPLIT(string value, string splitChar)
string SPLIT(string value, string splitChar, int index)
The first syntax option returns all of the split parts as an array of strings.
The second syntax option allows you to return a specific element from the resulting array, by specifying the zero-based index of the desired element.
Input
Object | Data Type | Description |
---|---|---|
value | String | The original string to look in. |
splitChar | String | The character that splits the strings. |
index | Integer | The item index to return. |
Example
You have an array of email addresses separated by a "|" but want these separated:
SPLIT("jb@companya.com|js@companyb.com|sc@companyc.com","|")
Will return "jb@companya.com; js@companyb.com; sc@companyc.com".
You have an array of products separated by a "|" but only want to return the second product in the list:
SPLIT("DataSync|Ouvvi|Consulting|Support","|",2)
Will return "Ouvvi".
This could be used to gather the domain from an email with the combined use of the ARRAYINDEX function:
ARRAYINDEX(SPLIT("support@simego.com","@"),2)
Will return 'simego.com'.
This can be used to return the company name from an email address:
SPLIT((SPLIT("support@simego.com","@",2)), ".", 1)
Will return "simego".
You could apply this to your column data by passing the email column into the function rather than the hard coded string. For example:
SPLIT((SPLIT(EmailAddress,"@",2)), ".", 1)