protect variable name in string and remove spaces