cesarz
❔ Unique Integer ID GEN from string input
and idk, maybe an additional check in the loop if there are any correct characters left?
There's a possibility that someone will for some reason name a file "
Abc######
" so the loop would continue for 6 more times for no reason, but idk if it makes too much of a difference26 replies
❔ Unique Integer ID GEN from string input
13 characters is quite a lot to work with already.
I can divide it in 'half' => 6 and 7 characters
Take 6 characters from the beginning of the input
And 7 characters from the end of the input
Unless the input length is < 13, then I just take every character.
That would probably work out fine enough?
26 replies
❔ Unique Integer ID GEN from string input
I could possibly try and reduce the possible characters by also ignoring numbers / or not adding 10 to the letters resulting in a range of 0 to 25 instead of 0 to 35.
Numbers are rarely used in my file names anyways so there is little to no risk in there being any collisions with this I suppose.
26 replies
❔ Unique Integer ID GEN from string input
For ulong limit
18_446_744_073_709_551_615
Testing this method using highest-value character z
(int 35) we get a limit of 12 characters, any higher that that and there's an overflow...
It's better than my previous 9 character limit but still far away from 32 character limit...26 replies
❔ Unique Integer ID GEN from string input
The string input will be a name given to a file in my game so I guess there is no limit to how big these can get, depends on the situation, but most likely not bigger than 32 characters I suppose (even if they are bigger I can just reduce them to 32 chars, with this length there shouldn't be any problems)
26 replies