Get Nth element of an array that returns from "string_to_array()" function

I am searching for a way to access to the Nth element of an array which is a result of string_to_array() function in PostgreSQL. For example,

Assume that a cell contains the string value: "A simple example" . If I use string_to_array() function, I will have an array of three strings as ('A','simple','example'). Now, without storing (I mean, on the fly) I want to access the 2nd element of this array, which is 'simple'.

During my googling, I saw an example to access the last element of the array but this barely solved my problem.

Is there a way to do this?


Solution 1:

select (string_to_array('1,2,3,4',','))[2];