20 lines
712 B
C#
20 lines
712 B
C#
namespace View_by_Distance.Shared.Models.Stateless;
|
|
|
|
internal abstract class Id
|
|
{
|
|
|
|
internal static bool NameWithoutExtensionIsIdFormat(string fileNameWithoutExtension)
|
|
{
|
|
bool result;
|
|
int intMinValueLength = int.MinValue.ToString().Length;
|
|
if (fileNameWithoutExtension.Length < 5 || fileNameWithoutExtension.Length > intMinValueLength)
|
|
result = false;
|
|
else
|
|
{
|
|
bool skipOneAllAreNumbers = fileNameWithoutExtension[1..].All(l => char.IsNumber(l));
|
|
result = (skipOneAllAreNumbers && fileNameWithoutExtension[0] == '-') || (skipOneAllAreNumbers && char.IsNumber(fileNameWithoutExtension[0]));
|
|
}
|
|
return result;
|
|
}
|
|
|
|
} |