for (int i=0;i<Key.Length;i++) { CryptKey+=string.Format("{0:d10}",Key[i].ToString()); } 为什么在这个CryptKey中那些0全没了?
CryptKey+=string.Format("{0:d10}",Key[i]);don't use tostring()! {0:d10} only for numberuse this:string s ="123"; int mustLength = 6; //定义长度 string str = new String('0',mustLength-s.Length) + s; MessageBox.Show(str);
string s ="123"; int mustLength = 6; //定义长度 string str = s.PadLeft(mustLength,'0'); MessageBox.Show(str);
int32 icust_id=123;
string strValue = string.Format("{0:d10}", icust_id);
//strValue的值为:"0000000123"
{
CryptKey+=string.Format("{0:d10}",Key[i].ToString());
}
为什么在这个CryptKey中那些0全没了?
int mustLength = 6; //定义长度
string str = new String('0',mustLength-s.Length) + s;
MessageBox.Show(str);
int mustLength = 6; //定义长度
string str = s.PadLeft(mustLength,'0');
MessageBox.Show(str);