0

我想将转换为小数的大字符串存储在 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...

有没有办法保留前面的零?

4

1 回答 1

1

为了保持您想要的顺序,将小数作为键并在需要时(即时)将它们格式化为字符串。

于 2013-05-06T14:31:14.070 回答