Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

additional string split functions #2926

Open
universalmind303 opened this issue Apr 23, 2024 · 0 comments
Open

additional string split functions #2926

universalmind303 opened this issue Apr 23, 2024 · 0 comments
Labels
feat 🎇 New feature or request

Comments

@universalmind303
Copy link
Contributor

Description

Add a few additional functions for splitting strings into arrays.

create table strings (v text);
insert into strings values ("foo bar"), ("foo_bar") ("foo bar baz");

Note: this is the current string_to_array function, but i think split is much more intuitive.

  • split: Split the string by a substring.
select split(v, ' ') from values;
----
["foo", "bar"]
["foo_bar"]
["foo", "bar", "baz"]
  • splitn: Split the string by a substring, restricted to returning at most n items.
select splitn(v, ' ', 2) from values;
----
["foo", "bar"]
["foo_bar"]
["foo", "bar baz"]
@universalmind303 universalmind303 added the feat 🎇 New feature or request label Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat 🎇 New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant