2023-10-18 10:56:41 +00:00
|
|
|
export const capitalize = (originalString: string, firstonly = false) => {
|
2023-12-20 07:45:29 +00:00
|
|
|
const s = (originalString || '').trim()
|
2023-10-18 10:56:41 +00:00
|
|
|
return firstonly
|
|
|
|
? s.charAt(0).toUpperCase() + s.slice(1)
|
|
|
|
: s
|
|
|
|
.split(' ')
|
|
|
|
.map((w) => w.charAt(0).toUpperCase() + w.slice(1))
|
|
|
|
.join(' ')
|
|
|
|
}
|