Make item dictionary implementations consistent

This commit is contained in:
Matt Nadareski
2024-10-19 22:39:23 -04:00
parent 97432a446a
commit 6a26a0d2fa
3 changed files with 182 additions and 221 deletions

View File

@@ -117,26 +117,26 @@ namespace SabreTools.Core.Tools
/// <summary>
/// Remove all chars that are considered path unsafe
/// </summary>
public static string? RemovePathUnsafeCharacters(string? input)
public static string RemovePathUnsafeCharacters(string? input)
{
if (string.IsNullOrEmpty(input))
return input;
return string.Empty;
foreach (char invalid in Path.GetInvalidPathChars())
{
input = input!.Replace(invalid.ToString(), string.Empty);
}
return input;
return input!;
}
/// <summary>
/// Remove all unicode-specific chars from a string
/// </summary>
public static string? RemoveUnicodeCharacters(string? input)
public static string RemoveUnicodeCharacters(string? input)
{
if (string.IsNullOrEmpty(input))
return input;
return string.Empty;
return new string(input.Where(c => c <= 255).ToArray());
}