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

Provide a trimAll/trimAll: to complete the trim messages #4533

Closed
astares opened this issue Sep 9, 2019 · 6 comments

Comments

@astares
Copy link
Member

commented Sep 9, 2019

We have

  • trimLeft
  • trimRight
  • trimBoth

but no way to replace overall separators or character provided in a block expression.

But this is something one often needs in parsing or data reading.

We should therefore provide additionally

  • trimAll
  • trimAll: aBlock
@juliendelplanque

This comment has been minimized.

Copy link
Member

commented Sep 10, 2019

I super-agree with that!

@Ducasse

This comment has been minimized.

Copy link
Member

commented Sep 10, 2019

Now I would prefer to have all these methods into a separated class because the API of string is just gigantic and parsing is not a good idea with strings.

@juliendelplanque

This comment has been minimized.

Copy link
Member

commented Sep 10, 2019

In fact, those are already implemented by #trimBoth and #trimBoth:

@astares

This comment has been minimized.

Copy link
Member Author

commented Sep 11, 2019

@juliendelplanque No trimBoth is only a combination of left and right. trimAll removes all (even the ones in the middle)

@Ducasse Having a rich String manipulation interface is a plus - not a downside.
Sure can easily have separate "utility classes" - but we do not want to play Java here ;)

@juliendelplanque

This comment has been minimized.

Copy link
Member

commented Sep 11, 2019

I continue discussion on the related PR #4534

@astares

This comment has been minimized.

Copy link
Member Author

commented Sep 13, 2019

https://twitter.com/awbjs/status/1172273315727101952?s=20

So we close

Twitter
“Reminded today that trimStart and trimEnd are in ES2019—a little later doing some organizing of my long term storage I found this. I guess somethings just keep recurring forever. (Looks like a bug in the comment on example line 4, something else that never changes)”

@astares astares closed this Sep 13, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.