Help with a custom function in Zoho CRM for Customer Names in Proper Case

Help with a custom function in Zoho CRM for Customer Names in Proper Case

Could you help me with a custom function in Zoho CRM for two fields we have in a custom module.

Field 1 - First & Middle Name
Field 2 - Last Name

I would like for Field 1 and Field 2 to be in Proper Case - however, there is often a space in the field and following a space the next word should also be in Proper Case.

Example - how it should be formatted

Field 1 - "John James"
Field 2 - "Smith"

Quite often the data would look like this...

Field 1 - "JOHN JAMES"
Field 2 - "SMITH"

or like this

Field 1 - "john james"
Field 2 - "smith"

Then some people have hyphens in their name - the data should look like this....

Field 1 - "John-James"
Field 2 - "Smith-Jones"

and not like this....

Field 1 "John-james"
Field 2 - "Smith-jones"

THANK YOU !!