Overview
What Convert to PascalCase does
Splits spaces, punctuation, acronym boundaries, and lower-to-upper transitions before capitalizing every identifier word.
| Category | Developer Tools |
|---|---|
| Action type | JavaScript |
| Result | Replace or copy text |
| Internet | Not required |
Example
Action and outcome
| Action | Outcome |
|---|---|
| Convert to PascalCaseSelected text: HTTP response code | HttpResponseCode |
Workflow
Use Convert to PascalCase
Follow these steps to convert selected words or identifiers to PascalCase with ActionClip.
- Select the text you want to use.
- Choose Convert to PascalCase from ActionClip.
- Review the result, then replace the selection or copy the new text.
Before you add it
Requirements and privacy
- Before you start: No setup required.
- Your selected text: Runs locally in ActionClip’s JavaScript sandbox. Selected text does not leave your Mac.
Inspect before installing
Action configuration
The definition below is included so you can inspect how the action works before downloading it.
JavaScript definition
function run(selected_text) {
const words = selected_text
.normalize("NFKD")
.replace(/\p{M}+/gu, "")
.replace(/([A-Z\d]+)([A-Z][a-z])/g, "$1 $2")
.replace(/([a-z\d])([A-Z])/g, "$1 $2")
.replace(/[^\p{L}\p{N}]+/gu, " ")
.trim()
.split(/\s+/)
.filter(Boolean)
.map((word) => word.toLowerCase());
if (!words.length) return "";
const capitalize = (word) => word.charAt(0).toUpperCase() + word.slice(1);
return words.map(capitalize).join("");
}