I'm doing some string manipulation with API returned fields, and they have some unique characteristics, hence why I'm looking to try to adjust them.
For example:
one field comes from the JSON as: "contract_time": "full_time"
Provided this, I would like to try and manipulate it so that I get the output "Full Time".
I am calling it directly as the below:
<BadgeComponentFirst>
<Typography color="red" fontSize="0.6em">
{job.contract_time}
</Typography>
How would I pass such string manipulation to an object to first, remove the '_' and capitalise and the first of each word?
Thanks
{fix(job.contract_time)}wherefixis whatever method you use to change it. As Pointy suggests mapping may be better, or use a library that converts betweensnake_caseand other formats.