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 string - avoid allocation of object array. Added StringHelpers.SplitAndTrimTokens #3311

Merged
merged 2 commits into from
Apr 14, 2019

Conversation

snakefoot
Copy link
Contributor

@snakefoot snakefoot commented Apr 14, 2019

Triggered by #3308 to avoid params-object-array unless needed. But also to encapsulate:

stringValue.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);

In a simpler method:

stringValue.SplitAndTrimTokens(';');

That also trims the tokens, and removes empty tokens.


This change is Reviewable

@304NotModified
Copy link
Member

👍 c# ext :)

Could you please add some test cases for SplitAndTrimTokens? If that one has a bug, that could have some serious consequences.

@304NotModified 304NotModified changed the title StringHelpers - SplitAndTrimTokens Split string - avoid params-object-array. Added StringHelpers.SplitAndTrimTokens Apr 14, 2019
@snakefoot
Copy link
Contributor Author

@304NotModified Could you please add some test cases for SplitAndTrimTokens?

Added some unit-tests

Copy link
Member

@304NotModified 304NotModified left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@304NotModified 304NotModified added this to the 4.6.3 milestone Apr 14, 2019
@304NotModified 304NotModified changed the title Split string - avoid params-object-array. Added StringHelpers.SplitAndTrimTokens Split string - avoid allocation of object array. Added StringHelpers.SplitAndTrimTokens Apr 14, 2019
@repo-ranger repo-ranger bot merged commit af2ca41 into NLog:dev Apr 14, 2019
@codecov-io
Copy link

Codecov Report

Merging #3311 into dev will decrease coverage by <1%.
The diff coverage is 100%.

@@          Coverage Diff           @@
##             dev   #3311    +/-   ##
======================================
- Coverage     80%     80%   -<1%     
======================================
  Files        356     356            
  Lines      28077   28085     +8     
  Branches    3739    3742     +3     
======================================
- Hits       22495   22489     -6     
- Misses      4503    4517    +14     
  Partials    1079    1079

@snakefoot snakefoot deleted the SplitAndTrim branch April 4, 2020 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants