Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 60a6662

Browse files
committed
Feat(data:Js): Add utility function to convert strings to Title Case
1 parent 10b68d7 commit 60a6662

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

‎public/data/javascript.json‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,20 @@
231231
],
232232
"tags": ["string", "case", "camelCase"],
233233
"author": "aumirza"
234+
},
235+
{
236+
"title": "Convert String to Title Case",
237+
"description": "Converts a given string into Title Case.",
238+
"code": [
239+
"function toTitleCase(str) {",
240+
" return str.toLowerCase().replace(/\\b\\w/g, (s) => s.toUpperCase());",
241+
"}",
242+
"",
243+
"// Example usage:",
244+
"console.log(toTitleCase('hello world test')); // Output: 'Hello World Test'"
245+
],
246+
"tags": ["string", "case", "titleCase"],
247+
"author": "aumirza"
234248
},
235249
{
236250
"title": "Remove Vowels from a String",

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /