自动加一的33进制编码

 private string To33(string str)

{

  string strBase="0123456789ABCDEFGHJKLMNPQRSTUVWXY";

  char[] charBase=strBase.ToCharArray();

  char[] chars=str.ToCharArray();

  for(int i=chars.length-1;i>-1;i--)

{

if(i==0&&chars[i]==charBase[strBase.Length-1])

{

 throw new Exception("超出范围");

}

int index=strBase.Indexof(char[i]);

if(index==strBase.length-1)

{

chars[i]=charBase[0];

}

else

{

chars[i]=charBase[index+1];

break;

}

}

string sResult=string.Empty;

foreach(char ch in chars)

{

sReturn+=ch.ToString();

}

return sResult;

 

}

转载于:https://www.cnblogs.com/lihfeiblogs/archive/2012/09/24/2700812.html

你可能感兴趣的:(自动加一的33进制编码)