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

SPLIT does not mimic R2 behaviour with STRING! delimiter #3095

Closed
rebolek opened this issue Nov 2, 2017 · 4 comments
Closed

SPLIT does not mimic R2 behaviour with STRING! delimiter #3095

rebolek opened this issue Nov 2, 2017 · 4 comments

Comments

@rebolek
Copy link
Contributor

rebolek commented Nov 2, 2017

Expected behavior

This is R2 version of parse:

>> line: "a,s.d#f;g"
== "a,s.d#f;g"
>> parse line ",.#;"
== ["a" "s" "d" "f" "g"]

Actual behavior

However, Red's split can’t reproduce the behaviour:

>> line: "a,s.d#f;g"
== "a,s.d#f;g"
>> split line ",.#;"
== ["a,s.d#f;g"]

Steps to reproduce the problem

See above 👆.

Red version and build date, operating system with version.

latest version on macOS

@xqlab
Copy link
Contributor

xqlab commented Nov 2, 2017

It can

>> line: "a,s.d#f;g"
== "a,s.d#f;g"
>> split line charset ",.#;"
== ["a" "s" "d" "f" "g"]
>>

@rebolek
Copy link
Contributor Author

rebolek commented Nov 3, 2017

Right, it can, but the question is, if it's bug or feature. I can live with both I guess 😃

@xqlab
Copy link
Contributor

xqlab commented Nov 3, 2017

feature by design

@dockimbel
Copy link
Member

It's by design.

Red's split is not meant to be limited to what R2's splitting with Parse could accomplish. Splitting with a sequence of characters instead of just a set of characters is an example of such extended feature. For splitting with a set of characters (like R2's parse), you have to provide a bitset! as shown above.

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

No branches or pull requests

3 participants