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 791e024

Browse files
committed
Feat(data:Js): Add utility function to convert strings to Pascal Case
1 parent 60a6662 commit 791e024

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
@@ -245,6 +245,20 @@
245245
],
246246
"tags": ["string", "case", "titleCase"],
247247
"author": "aumirza"
248+
},
249+
{
250+
"title": "Convert String to Pascal Case",
251+
"description": "Converts a given string into Pascal Case.",
252+
"code": [
253+
"function toPascalCase(str) {",
254+
" return str.replace(/\\b\\w/g, (s) => s.toUpperCase()).replace(/\\W+(.)/g, (match, chr) => chr.toUpperCase());",
255+
"}",
256+
"",
257+
"// Example usage:",
258+
"console.log(toPascalCase('hello world test')); // Output: 'HelloWorldTest'"
259+
],
260+
"tags": ["string", "case", "pascalCase"],
261+
"author": "aumirza"
248262
},
249263
{
250264
"title": "Remove Vowels from a String",

0 commit comments

Comments
(0)

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