2024-03-13 15:44:59 +01:00
|
|
|
|
namespace TaikoWebUI.Utilities
|
|
|
|
|
{
|
|
|
|
|
public interface IStringUtil
|
|
|
|
|
{
|
|
|
|
|
List<string> SplitIntoGroups(string str, int groupSize);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class StringUtil : IStringUtil
|
|
|
|
|
{
|
|
|
|
|
public List<string> SplitIntoGroups(string str, int groupSize)
|
|
|
|
|
{
|
|
|
|
|
List<string> groups = new List<string>();
|
|
|
|
|
for (int i = 0; i < str.Length; i += groupSize)
|
|
|
|
|
{
|
|
|
|
|
groups.Add(str.Substring(i, Math.Min(groupSize, str.Length - i)));
|
|
|
|
|
}
|
|
|
|
|
return groups;
|
|
|
|
|
}
|
2024-08-09 15:46:55 +02:00
|
|
|
|
|
|
|
|
|
public bool OnlyHexInString(string test)
|
|
|
|
|
{
|
|
|
|
|
return System.Text.RegularExpressions.Regex.IsMatch(test, @"\A\b[0-9a-fA-F]+\b\Z");
|
|
|
|
|
}
|
2024-03-13 15:44:59 +01:00
|
|
|
|
}
|
|
|
|
|
}
|