-
Notifications
You must be signed in to change notification settings - Fork 9.8k
/
UpperInvariantLookupNormalizer.cs
32 lines (30 loc) · 1.32 KB
/
UpperInvariantLookupNormalizer.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.AspNetCore.Identity
{
/// <summary>
/// Implements <see cref="ILookupNormalizer"/> by converting keys to their upper cased invariant culture representation.
/// </summary>
public sealed class UpperInvariantLookupNormalizer : ILookupNormalizer
{
/// <summary>
/// Returns a normalized representation of the specified <paramref name="name"/>.
/// </summary>
/// <param name="name">The key to normalize.</param>
/// <returns>A normalized representation of the specified <paramref name="name"/>.</returns>
public string NormalizeName(string name)
{
if (name == null)
{
return null;
}
return name.Normalize().ToUpperInvariant();
}
/// <summary>
/// Returns a normalized representation of the specified <paramref name="email"/>.
/// </summary>
/// <param name="email">The email to normalize.</param>
/// <returns>A normalized representation of the specified <paramref name="email"/>.</returns>
public string NormalizeEmail(string email) => NormalizeName(email);
}
}