Secure Hash
6
An all in one function that formats a given file's Size from bytes to gB.
6
I use something similar to this in an application named Shock 3. It provides you with your own Custom settings that can handle your own Custom types as well.
7
The modus operandi for this is similar to that taken by PHP's implementation of such functions. It's comparitively memory-intensive, but is much faster than running a whole bunch of tests.
Basically, you set a mask -- an array of 256 null bytes -- and set those that correspond to characters you wish to trim. Then, rather than having to test if a character is in the set of characters to trim(O(n), or linear time on *ws), you just test once (O(1), or unit time) to see if the byte in question is set.
And of course, to trim(), you just wrap trim() around both ltrim() and rtrim().
One point of caution: these functions trim in place, so copy strings before trimming them. (Of course, if you usually want access to both pre- and post-trimmed strings, you could always make these malloc() a new string and return a pointer to it . . . )
Basically, you set a mask -- an array of 256 null bytes -- and set those that correspond to characters you wish to trim. Then, rather than having to test if a character is in the set of characters to trim(O(n), or linear time on *ws), you just test once (O(1), or unit time) to see if the byte in question is set.
And of course, to trim(), you just wrap trim() around both ltrim() and rtrim().
One point of caution: these functions trim in place, so copy strings before trimming them. (Of course, if you usually want access to both pre- and post-trimmed strings, you could always make these malloc() a new string and return a pointer to it . . . )
7
Turns any string backwards. If you input "Test" it gives out "tseT". Hope it's useful.
The snippet shows how to use it.
The snippet shows how to use it.
7
Have you ever tried to use Color.Blue.ToString and gotten undesired results?
Or have you ever tried to save a color to an INI and not be able to reproduce it the next time around?
The methods below will help you in your conquest of converting the Color structure to HTML (#FF0000) and back to a Color structure again.
Or have you ever tried to save a color to an INI and not be able to reproduce it the next time around?
The methods below will help you in your conquest of converting the Color structure to HTML (#FF0000) and back to a Color structure again.
7
I use this function when passing an array to a function being called from setTimeout();
7
mattrmiller
Formats milliseconds into a duration string.
7
Remove newslines from a string.
8
Configurable number formatter.
8
This could be used for any type of simple hash checking. It could also be used to store a "password" that had to be verified. This code is completely managed.









