'In Trino (Presto) SQL, how do you convert a varchar (string) to an array of characters (char)?
I want to create a array of characters from a varchar field. For example, from 'test', I want to have ARRAY['t', 'e', 's', 't'].
Solution 1:[1]
Here's one way:
SELECT REGEXP_EXTRACT_ALL('test?', '.') AS letters;
returns:
| # | letters |
|---|---|
| 1 | ["t","e","s","t","?"] |
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Will Fitzgerald |
