1.多位数字字母组成,每位取值0-9A-Z
/// <summary>
/// 获取下一个顺序码根据上一个(数字字母组合)
/// </summary>
/// <param name="str">上一个顺序码</param>
/// <returns></returns>
public static string ESequenceCode(string code)
{
if (string.IsNullOrWhiteSpace(code))
{
return "";
}
code = code.ToUpper();
int max = ; int min = ;
//数组48-57英文65-90(大写)/97-122(小写)
char[] strs = code.ToCharArray();
ASCIIEncoding ascii = new ASCIIEncoding();
for (int i = strs.Length - ; i > -; i--)
{
int ascII = ascii.GetBytes(strs[i].ToString())[];
int ascIINew = (ascII == max ? min : (ascII + (ascII == ? : )));
byte[] byteArray = new byte[] { (byte)ascIINew };
strs[i] = Convert.ToChar(ascii.GetString(byteArray));
if (ascII != max)
{
break;
}
}
return string.Join("", strs);
}