Skip to content

string.Split not working as expected when using multiple string separators and StringSplitOptions.TrimEntries #73194

Closed

Description

@ccamposh

Description

Considering these next C# code snippets results is the trimmed string "text",
" text ".Split(',', StringSplitOptions.TrimEntries)
" text ".Split(",", StringSplitOptions.TrimEntries)
" text ".Split(new char[] {','}, StringSplitOptions.TrimEntries)

This next code should have the same result:
" text ".Split(new string[] {","}, StringSplitOptions.TrimEntries)
The result of this last call is " text ", not trimmed.

Configuration

Dotnet version 6.0.100
OS: MacOs BigSur 11.4
Architecture: x64

Regression?

Not verified in previous versions

Activity

  1. jplonghi commented on Aug 1, 2022

    @jplonghi
  2. transferred this issue fromdotnet/coreon Aug 1, 2022
  3. ghost added
    untriagedNew issue has not been triaged by the area owner
    on Aug 1, 2022
  4. self-assigned this
    on Aug 2, 2022
  5. added this to the 7.0.0 milestone on Aug 2, 2022
  6. added and removed
    untriagedNew issue has not been triaged by the area owner
    on Aug 2, 2022
  7. ghost added
    in-prThere is an active PR which will close this issue when it is merged
    on Aug 2, 2022
  8. ghost removed
    in-prThere is an active PR which will close this issue when it is merged
    on Aug 5, 2022
  9. ghost locked as resolved and limited conversation to collaborators on Sep 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions