w3resource

PostgreSQL STRING_TO_ARRAY() function

STRING_TO_ARRAY() function

This function is used to split a string into array elements using supplied delimiter and optional null string.

Syntax:

string_to_array(text, text [, text])

Return Type:

text[]

PostgreSQL Version: 9.3

Example: PostgreSQL STRING_TO_ARRAY() function

Code:

SELECT string_to_array('xx~^~yy~^~zz', '~^~', 'yy');

Sample Output:

 string_to_array
-----------------
 {xx,NULL,zz}
(1 row)

Previous: ARRAY_UPPER function
Next: UNNEST function



Follow us on Facebook and Twitter for latest update.