0

Validate password so that it does not allow character repitition n times

So you want to make sure that your ascii password doesn’t haven any character recurring more than n times.

Here is what I came up with!

Unicoding…just increase your int array to accommodate!

static bool HasMultiple(string pass,int num)
{
var CharCheck = new int[256];
for (int x = 0; x < pass.Length; x++) {

if (CharCheck[pass[x]] > num-1)
{
return true;
}
else
{
CharCheck[pass[x]] ++;
}
}
return false;
}