Get a safe variable name from a given string.