Safer implementation for String::NumberToString and String::IntToString