Skip to content

[Enhancement] function SPLIT_BY_STRING(<str>, <separator>[, <limit>]) #55788

@ZJHZH

Description

@ZJHZH

Search before asking

  • I had searched in the issues and found no similar issues.

Description

function SPLIT_BY_STRING adds a third optional parameter to limit the size of the array after segmentation

Solution

SELECT SPLIT_BY_STRING('one,two,three,', ',');       -- ["one", "two", "three", ""]
SELECT SPLIT_BY_STRING('one,two,three,', ',', -1);   -- ["one", "two", "three", ""]
SELECT SPLIT_BY_STRING('one,two,three,', ',', 2);    -- ["one", "two,three,"]
SELECT SPLIT_BY_STRING('one,two,three,', ',', 3);    -- ["one", "two", "three,"]
SELECT SPLIT_BY_STRING('one,two,three,', ',', 4);    -- ["one", "two", "three", ""]
SELECT SPLIT_BY_STRING('one,two,three,', ',', 5);    -- ["one", "two", "three", ""]

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions