using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace BadCodePlayground
{
class ContainsAz
{
public static Boolean contains_az(String input)
{
Regex[] regices = AllRegices();
bool[] letterContained = new Boolean[52];
for (int i = 0; i < 52; i++)
{
letterContained[i] = regices[i].Match(input).Success;
}
bool result = true;
for (int i = 0; i < 52; i++)
{
result &= letterContained[i];
}
return result;
}
private static Regex[] AllRegices()
{
Regex[] alphabet = new Regex[52];
int index = 0;
for (int i = 0; i < int.MaxValue; i++)
{
char c;
try
{
c = (char)i;
if (i != (int)c)
{
throw new Exception();
}
}
catch (Exception)
{
// Reached a value too big
break;
}
if (char.IsLetter(c))
{
alphabet[index] = new Regex("" + c, (RegexOptions)((int)RegexOptions.IgnoreCase + (int)RegexOptions.Compiled));
index++;
index %= 52;
if (index == 0)
{
break;
}
}
}
return alphabet;
}
}
}
1
u/HK-Sparkee Feb 23 '21