KIT!
ce3795bb50
Don't break Access codes into groups of 4 if they aren't a multiple of 4 or if they aren't hexadecimal only (This is useful if a user only uses a nickname as an access code and not a card id) Changed color of is-current-user on the leaderboard so text is legible in dark mode. Made Leaderboard useable on mobile as well by removing responsive breakpoints.
25 lines
711 B
C#
25 lines
711 B
C#
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;
|
|
}
|
|
|
|
public bool OnlyHexInString(string test)
|
|
{
|
|
return System.Text.RegularExpressions.Regex.IsMatch(test, @"\A\b[0-9a-fA-F]+\b\Z");
|
|
}
|
|
}
|
|
} |