Forest_Client/Forest/Assets/Scripts/Gameplay2/GameBuild/GameBuildUtils.cs

32 lines
814 B
C#
Raw Normal View History

using System.IO;
2024-07-16 16:00:20 +08:00
using System.Text.RegularExpressions;
namespace Framework.GameBuild
{
public static class GameBuildUtils
{
public static int ExtractNumber(string input)
{
var str = input;
int lastIndex = input.LastIndexOf('_');
if (lastIndex != -1 && lastIndex < input.Length - 1)
{
str = input.Substring(lastIndex + 1);
}
Match match = Regex.Match(str, @"\d+");
if (match.Success)
{
return int.Parse(match.Value);
}
return 0;
}
public static string GetFileNameWithoutExtension(string fileName)
{
return Path.GetFileNameWithoutExtension(fileName);
}
2024-07-16 16:00:20 +08:00
}
}