method to change object attribute name into a form caption

When using a bean an item datasource for a form the name for the fields are automatically generated from the attributes name with space separated words.
I once met the method somewhere in the Form class but i could not find it when i looked recently.

The method gets a string value like
middleName
and change it into
Middle Name

I need to use the method for setting field names in the form field factory.

Can someone please help telling me which class have the method?
Thanks

DefaultFieldFactory.createCaptionByPropertyId()