mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Move another text helper method
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace SabreTools.Core.Tools
|
||||
@@ -22,6 +25,18 @@ namespace SabreTools.Core.Tools
|
||||
return input;
|
||||
}
|
||||
|
||||
// <summary>
|
||||
/// Remove all chars that are considered path unsafe
|
||||
/// </summary>
|
||||
public static string? RemovePathUnsafeCharacters(string? input)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(input))
|
||||
return input;
|
||||
|
||||
List<char> invalidPath = Path.GetInvalidPathChars().ToList();
|
||||
return new string(input.Where(c => !invalidPath.Contains(c)).ToArray());
|
||||
}
|
||||
|
||||
#region Helpers
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user