How to convert from CamelCase to Underscores and Underscores to CamelCase

In some old directory I found these functions to easely convert camelcase to underscore style naming.

The usage is quite simple, feed it with a string and you get a replaced string in return.