Suppose I have a string such as:
abcdefghi
and I would like to reformat it as:
abc def ghi
(that is, I have added some formatting spaces to the string).
Is there a PostgreSQL function which will do that? Something like:
reformat(abcdefghi,'xxx xxx xxx')
I know there isn’t the above function, but there might be a built in function to do something like that.
If not, I am happy to write such a function, but I though I would check.
abcdefghijklmno
will beabc def ghi jkl mno
). What should happen if the string length is not a multiple of 3?regexp_replace
orformat
function for this kind of problems.