Rename whitespace with underscore

A little question, is it possible to rename objects by typing in the edittext field f.e. "Box version concept" and it would be automatically rename the objects with an underscore f.e. "Box_version_concept"

Thx