ASP.NET convert string to pre-defined length string
Here at work we are converting over to a new payment system which allows only a maximum of 7 characters in the product code. The product codes we are using can and will excede 7 characters (changing would require changing past orders so changing the codes is out of the question).
The product code for us is the event code (ie ccsws2011), the old system allowed us to pass the entire event code in, whereas the new system is limiting us to only 7 characters. I do not want to do a look up table at all. I want to be able to create a product code list for the system (outside the website) and then have the code within the website automatically convert our event code to the product code I created outside the website and pass it to the payment system.
Is there a way to hash our product code into a 7 character product code for the new system?
I.E.:
our product code: ccsws2011 Hashed product code: xxx开发者_C百科xxxx
Thanks for your efforts everyone, another value was decided upon to be used for the item code which nullified this issue. Thank you again everyone
精彩评论