我想将 3 位数字长的十六进制转换为 6 位数字。例如 12F 应为 00012F。我尝试了这段代码,但没有成功。
endadd = Format(endadd, "000000")
Run Code Online (Sandbox Code Playgroud) 我目前有2个字典,其中包含30,000个密钥.
我目前正在使用两个foreach循环来查找dict1中的唯一键.我将dict2中的唯一键写入另一个字典(3).
如果密钥匹配,我执行检查以查看值是否相同.如果它们不相同则打印.
使用foreach是否更好,它似乎正在影响性能.还有其他更快的解决方案或内置功能吗?我试着用dict.contains方法.
Dict1 Dict2
Keys Values Keys Values
S0111 00000 S0000 00010
S0000 00010 S0020 00015
S0020 00015 S0040 00150
S0040 00200 S0050 00250
Run Code Online (Sandbox Code Playgroud)
foreach (KeyValuePair<string, string> sourceRow in sourceData)
{
foreach (KeyValuePair<string, string> dumpRow in dumpData)
{
// A in C, skip
if (sourceRow.Key == dumpRow.Key)
{
Is_Unique_Address = false;
if (sourceRow.Value != dumpRow.Value)
{
Data_Mismatch_Criteria(sourceRow.Key, sourceRow.Value, dumpRow.Key, dumpRow.Value);
}
}
}
}
Run Code Online (Sandbox Code Playgroud)