问题描述
你好,我需要建立一个收据号,该收据的值是这个
RecieptCode LastRecieptNumber RecieptDisplayDigits
Rcp2008- 248 8
现在主要问题在receipdisplayDigits
我在python中知道如果我写z * 8将会是zzzzzzzz
我想在C#中使用相同的功能,但是如果我这样做了,我将无法添加最后一个接收号码/
>
这怎么办?
我有另一种方法,但可以肯定我的方法会更好.我的方法是将lastreceiptnumber
加10 ^(receipt display digt),然后删除1和编写如下所示的收据代码
上面的示例
10 ^ 8 = 100000000
100000000 + 249(因为它应该是新的收据)= 100000249
将其转换为字符串并删除1 = 00000249
然后我添加收据代码
有没有更好的方法考虑性能
最佳问候
Hello there i need to build a receipt number the values that am receiveing is this
RecieptCodeLastRecieptNumberRecieptDisplayDigits
Rcp2008-248 8
now the main prob is in receipdisplayDigits
i know in python if i write z*8 it will be zzzzzzzz
i want the same thing in C# but if i did it i will not be able to add the last reciept number/
how could this be done?
i have another method but am sure there would be a better one my method is to add the lastreceiptnumber
with 10^(receipt display digt) then i remove the 1 and write the receipt code it will look like this
the example above
10^8 = 100000000
100000000 + 249 (since it should be new receipt) = 100000249
Convert it to string and remove the 1 = 00000249
Then i add the receipt code
Is there better way taking into concideration the performance
Best Regards
推荐答案
int newNumber = lastReceiptNumber + 1;<br />string displayNumber = newNumber.ToString("D" + receiptDisplayDigits);
这篇关于如何建立收据号码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!