Typos
Changecaption

Change Caption

This Change Caption Function is used for Converting the Cpations Text according to the requirements.

Change Cap

changeCap.tsx
export const changeCaption = (text: string) => {
  if (!text) {
    return ''
  }
  return text
    .replace('_', '')
    .split('')
    .map((s: string) => `${s.charAt(0).toUpperCase()}${s.slice(1)}`)
    .join(' ')
}

Usage

blogCard.tsx
const HeadingName = changeCaption(res?.data?.name)
return <h1>{HeadingName}</h1>

Output

output.tsx
Input => 'Thuta_sann'
 
Output => 'T H U T A S A N N'