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

New functions STR_SUBSTRING_AFTER and STR_SUBSTRING_BEFORE #513

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

oswaldobapvicjr
Copy link
Contributor

This push introduces new string functions:

  • STR_SUBSTRING_AFTER(string, separator)
  • STR_SUBSTRING_BEFORE(string, separator)

Examples:

  • STR_SUBSTRING_AFTER("file.json", ".")
    • returns "json"
  • STR_SUBSTRING_BEFORE("2024/10/23", "/")
    • returns "2024"

Copy link

sonarcloud bot commented Oct 24, 2024

@oswaldobapvicjr oswaldobapvicjr changed the title New functions STR_SUBSTRING_AFTER/BEFORE New functions STR_SUBSTRING_AFTER and STR_SUBSTRING_BEFORE Oct 24, 2024
@uklimaschewski
Copy link
Collaborator

Why not defining a single method STR_SPLIT(string, separator)? It could return an array of strings (similar to String.split(String regex)).

Using STR_SPLIT("file.json", ".")[1] would return "json".
Using STR_SPLIT("2024/10/23", "/")[0] would return "2024".

You would even have much more possibilities.

I am just unsure of using a regex or just a simple string as separator is better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants