[C#]AlphaSequence 字串序列 34進制(0-9,A-Z但不包含I,O)
private void button3_Click(object sender, EventArgs e)
{
string SerialNow = "CZZ0Z";
int i = 0;
while (i < 3000)
{
SerialNow = AlphaSequence(SerialNow);
i++;
}
}
public string AlphaSequence(string input)
{
string alphabet = "0123456789ABCDEFGHJKLMNPQRSTUVWXYZ";
char[] sequence = input.ToCharArray();
for (int i = sequence.Length - 1; i >= 0; i--)
{
char currentChar = sequence[i];
if (currentChar == alphabet[alphabet.Length - 1])
{
sequence[i] = alphabet[0];
}
else
{
int index = alphabet.IndexOf(currentChar);
sequence[i] = alphabet[index + 1];
break;
}
}
return new string(sequence);
}
ref web:
https://blog.csdn.net/az44yao/article/details/77852575
留言
張貼留言