public static string Fill(string pStrSource)
{
switch(pStrSource.Length)
case 1:return "0000000" + pStrSource;
case 2:return "000000" + pStrSource;
case 3:return "00000" + pStrSource;
case 4:return "0000" + pStrSource;
case 5:return "000" + pStrSource;
case 6:return "00" + pStrSource;
case 7:return "0" + pStrSource;
default:return pStrSource;
}
} 加上這個函式,然後Convert.toString(b,2)替換成Fill(Convert.toString(b,2)),其他不用改。
public static string Fill(string pStrSource)
{
switch(pStrSource.Length)
{
case 1:return "0000000" + pStrSource;
case 2:return "000000" + pStrSource;
case 3:return "00000" + pStrSource;
case 4:return "0000" + pStrSource;
case 5:return "000" + pStrSource;
case 6:return "00" + pStrSource;
case 7:return "0" + pStrSource;
default:return pStrSource;
}
} 加上這個函式,然後Convert.toString(b,2)替換成Fill(Convert.toString(b,2)),其他不用改。