Encoding a string as an integer .NET
Posted
by Paul Knopf
on Stack Overflow
See other posts from Stack Overflow
or by Paul Knopf
Published on 2010-06-13T04:13:25Z
Indexed on
2010/06/13
4:22 UTC
Read the original article
Hit count: 292
string-manipulation
|encoding
I have a string that I would like represented uniquely as an integer.
For example: A3FJEI = 34950140
How would I go about writing a EncodeAsInteger(string) method. I understand that the amount of characters in the string will make the integer increase greatly, forcing the value to become a long, not an int.
Since I need the value to be an integer, I don't need the numerical representation to be entirely unique to the string.
Maybe I can foreach through all the characters of the string and sum the numerical keycode of the character.
© Stack Overflow or respective owner