Skip to content

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

Closed
@ccamposh

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions