我想在SortedDictionary(作为键)中存储转换为小数的大字符串,但它们必须符合某种格式...由于排序字符串的性质,它们不会像十进制那样正确放置。以下是一些例子:
Public dic_Extracted As New Dictionary(Of Decimal, clsBillExtract)
'Display the keys and their index in the dictionary (as string and as decimal)
"000000000000000000000000000" 'String Index = 0, Decimal Index = 0
"001000000000000000000000000" 'String Index = 1, Decimal Index = 1
"002000000000000000000000000" 'String Index = 3, Decimal Index = 2
"010000000000000000000000000" 'String Index = 2, Decimal Index = 3
当键在字典中以小数形式放置时,前面的零将被修剪......如下所示:
字符串:“001000000000000000000000000”将是关键字1000000000000000000000000 ...
有没有办法保留前面的零?
答案 0 :(得分:1)
要保持您想要的顺序,请将十进制数作为键,并在需要时(即时)将它们格式化为字符串。