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

Expand string and span extension methods #10629

Merged
merged 5 commits into from
Jul 17, 2024

Conversation

DustinCampbell
Copy link
Member

This change covers several pieces of work on shared extension methods:

  1. Augment and document AsSpan(), AsSpanOrDefault(), AsMemory(), and AsMemoryOrDefault() extension methods targeting string.
  2. Augment and document Contains(), IndexOf(), StartsWith(), and EndsWith() extension methods targeting string.
  3. Add AsSpan() and AsMemory() extensions methods targeting array and Razor's polyfill Index and Range types.

- Add overloads for string.AsSpan() and string.AsMemory() that take Razor's Index and Range polyfill types.
- Add overloads for string.AsSpanOrDefault() and string.AsMemoryOrDefault() that take start, start+length, and Razor Index and Range polyfill types.

Note: If compiling for .NET, these forward to the relevant runtime methods.
Add overloads for string.Contains(), IndexOf(), StartsWith, and EndsWith() extensions methods that exist on .NET Core but not on .NET Framework or .NET Standard 2.0
Since moving to System.Collections.Immutable 8.0, this extension method is no longer needed.
@DustinCampbell DustinCampbell requested review from a team as code owners July 16, 2024 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants