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

Add function oos_util_string.strtok #174

Open
jeffreykemp opened this issue Nov 3, 2017 · 2 comments
Open

Add function oos_util_string.strtok #174

jeffreykemp opened this issue Nov 3, 2017 · 2 comments

Comments

@jeffreykemp
Copy link

Tokenize a string. Similar in functionality to strtok from C and PHP.

Useful in procedural code when the delimiter character(s) can change from token to token - i.e. not a fixed set of delimiters for the whole string.

I'll update with a simple implementation.

@alexys009
Copy link

Hi, Jeff.
I have a pipelined function (in my lib package) I am using for many years.
It can be used in sql or pl/sql. Here its interface
function str2tbl (p_str clob, p_delimiter varchar2:= ',|;.', p_encloser varchar2:='"', p_low varchar2 := 'y'
, p_split number:=0, p_char varchar2:=chr(1)) return str_arr pipelined;

It seems that it does what you are looking for, although not exactly C or PHP tokenizer.
If you are interested I can submit function code.

Regards,
Alex

@jeffreykemp
Copy link
Author

Hi Alex, that's nice and might make a good addition to this package, but it's not a like-for-like replacement for strtok.

strtok is called once per token, and you can give a different delimiter (or set of delimiters) for each token.

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

No branches or pull requests

3 participants