0
Generate Unique Number Using a Unique String
Is there any way to generate a unique number using a unique string? For example: A string "abcd" would generate a unique number 1234 every time it passes through the algorithm.
6 Respostas
+ 8
You can use UUID Module!
0
Martin Taylor Does hash code generate only numbers or alpha numeric characters? I needed only integers.
0
There are many ways
As you have said that it should convert abcd to 1234 which means a is 1, b is 2, c is 3 and d is 4.
There are 26 letters.
You can make the program with just if else condition.
if a
Then 1
If b
Then 2
If c
then 3
If d
Then 4
If e
Then 5
If f
Then 6
....
And continued....
Other way is using Hash Functions. Which will give you a unique number but it will be different in different tries.