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

Inconsistency with the String class's chomp & strip #3773

Closed
exts opened this issue Dec 24, 2016 · 3 comments
Closed

Inconsistency with the String class's chomp & strip #3773

exts opened this issue Dec 24, 2016 · 3 comments

Comments

@exts
Copy link

exts commented Dec 24, 2016

So I'm new to crystal and I was looking at the standard library and I realized that there's an inconsistency with a few of the functions and I'm not sure about others as I haven't checked, but you have two different functions that follow the same rules eg.: chomp and strip

The problem is with strip the main definition strips the beginning and end of a string whilist the chomp definition strips the end of a string . Now that's fine if they didn't attempt to follow the same rules. strip has a lstrip and a rstrip variation which only purpose is to strip only the left or right of a string while chomp only has a lchomp while if rchomp's expected functionality currently resides in chomp since rchomp doesn't actually exist.

Wouldn't it be appropriate for chomp to follow the same rules as strip and have an lchomp and rchomp while chomp strips the string | char from the beginning AND end of a string?

Just seems like a weird inconsistency with the standard library that I wanted to address while there's still breaking changes being made.

Kind regards.

@Sija
Copy link
Contributor

Sija commented Dec 24, 2016

See #3729

@exts
Copy link
Author

exts commented Dec 24, 2016

Thanks @Sija, I thought I searched properly, but the results were different.

@exts exts closed this as completed Dec 24, 2016
@exts exts reopened this Dec 25, 2016
@ysbaddaden
Copy link
Contributor

Closing, the issue is an exact duplicate of #3729

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