Files
CustomizeTool/CustomizePlus/Core/Helpers/NameParsingHelper.cs
2024-01-09 22:52:17 +03:00

23 lines
593 B
C#

namespace CustomizePlus.Core.Helpers;
//todo: better name
internal static class NameParsingHelper
{
internal static (string Name, string? Path) ParseName(string name, bool handlePath)
{
var actualName = name;
string? path = null;
if (handlePath)
{
var slashPos = name.LastIndexOf('/');
if (slashPos >= 0)
{
path = name[..slashPos];
actualName = slashPos >= name.Length - 1 ? "<Unnamed>" : name[(slashPos + 1)..];
}
}
return (actualName, path);
}
}