Remove the last character of a string: net10.0 retarget, range and StringBuilder.Remove benchmarks, emoji-safe helper - #2202
Merged
Conversation
…uilder.Remove benchmarks, add text-element helper - Retarget both projects from net8.0 to net10.0 - BenchmarkDotNet 0.13.12 to 0.15.8 - Test.Sdk 18.10.0, MSTest 4.4.0, coverlet.collector 10.0.1 - Add RemoveLastCharUsingRange and RemoveLastCharUsingStringBuilderRemove benchmarks - Rename RemoveLastCharUsingStringBuilder to RemoveLastCharUsingStringBuilderLength - Add RemoveLastTextElement, an emoji-safe removal helper - Three new tests, nine in total
…last-character-of-a-string
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Updates the
strings-csharp/RemoveLastCharOfAStringsample alongside a rewrite of the matching article.net8.0tonet10.0.0.13.12to0.15.8;Microsoft.NET.Test.Sdk18.10.0, MSTest4.4.0,coverlet.collector10.0.1.RemoveLastCharUsingRange, so theinputString[..^1]expression the article prints is measured like the rest.RemoveLastCharUsingStringBuilderRemove, thesb.Remove(sb.Length - 1, 1)form.RemoveLastCharUsingStringBuildertoRemoveLastCharUsingStringBuilderLength, so the two StringBuilder rows in the results table say which is which.RemoveLastTextElement, a text-element aware helper that removes a whole character rather than a singlechar, so a string ending in an emoji does not lose half a surrogate pair.