Use .IndexOf(char/byte) where possible (#9539)

This commit is contained in:
Ben Adams 2019-04-22 18:05:40 +01:00 committed by Andrew Stanton-Nurse
parent 9b999b3afb
commit 48c97b425e
2 changed files with 2 additions and 2 deletions

View File

@ -109,7 +109,7 @@ namespace Microsoft.AspNetCore.Routing.Matching
var port = ReadOnlySpan<char>.Empty; var port = ReadOnlySpan<char>.Empty;
// Split into host and port // Split into host and port
var pivot = host.IndexOf(":"); var pivot = host.IndexOf(':');
if (pivot >= 0) if (pivot >= 0)
{ {
port = host.Slice(pivot + 1); port = host.Slice(pivot + 1);

View File

@ -226,7 +226,7 @@ namespace Microsoft.AspNetCore.Authentication.JwtBearer
// https://tools.ietf.org/html/rfc6750#section-3.1 // https://tools.ietf.org/html/rfc6750#section-3.1
// WWW-Authenticate: Bearer realm="example", error="invalid_token", error_description="The access token expired" // WWW-Authenticate: Bearer realm="example", error="invalid_token", error_description="The access token expired"
var builder = new StringBuilder(Options.Challenge); var builder = new StringBuilder(Options.Challenge);
if (Options.Challenge.IndexOf(" ", StringComparison.Ordinal) > 0) if (Options.Challenge.IndexOf(' ') > 0)
{ {
// Only add a comma after the first param, if any // Only add a comma after the first param, if any
builder.Append(','); builder.Append(',');