toTitleCase
Converts the str to title case, where the first letter of each word is capitalized.
Usage Scenarios
- Title Formatting: In text processing, format titles to title case.
- Data Presentation: Present text in a more professional and readable format.
Example
import { toTitleCase } from 'funtool/string'
toTitleCase('hello_world'); // ✅ 'Hello World'
toTitleCase('hello-world'); // ✅ 'Hello World'
toTitleCase('user_id'); // ✅ 'User Id'
Signature
function toTitleCase(str: string): string
Parameters
str ( string ): The input string.
Returns
- (
string ): A new string in title case format.