Convert PascalCase to SCREAMING_SNAKE_CASE!

String
Result

Convert PascalCase to SCREAMING_SNAKE_CASE!

Is the variable naming in the code you copied from somewhere else different from your code? Don't worry! It converts variables to your desired naming convention!

Converts PascalCase names to SCREAMING_SNAKE_CASE: UserLoggedIn → USER_LOGGED_IN. Event classes, message types and TypeScript enum members are often PascalCase, while action type strings, Java enum constants and database enum values are traditionally upper-case with underscores.

Paste a union of event names, an enum or a list of class names to get the constant-style codes that go over the wire or into a constants file.

How to use

  1. Select PascalCase on the left and SCREAMING_SNAKE_CASE on the right.
  2. Paste the type union, enum members or event names into String.
  3. Copy the constant names from Result.

Example

Input (PascalCase)
type Action =
  | { type: "UserLoggedIn" }
  | { type: "CartItemAdded" }
  | { type: "CheckoutFailed" };
Output (SCREAMING_SNAKE_CASE)
type Action =
  | { type: "USER_LOGGED_IN" }
  | { type: "CART_ITEM_ADDED" }
  | { type: "CHECKOUT_FAILED" };

The three action types become Redux-style constants. Action is a single word, so the type name itself is not changed.

Supported features

  • Separates words at each capital and upper-cases them: CartItemAdded → CART_ITEM_ADDED.
  • Converts names inside string literals, which is where action types and message codes usually are.
  • Digits stay in their word: Oauth2TokenIssued → OAUTH2_TOKEN_ISSUED.

Use cases

Redux or event-bus action types

Event names designed as CheckoutFailed can be turned into CHECKOUT_FAILED constants for reducers, analytics events or a message broker that expects upper-case codes.

Database enum values for a C# or TypeScript enum

When a PascalCase enum has to be stored in a PostgreSQL enum or a VARCHAR column with upper-case values, convert the members to get the stored values.

Notes and limitations

  • Leading acronyms are kept as one segment: HTTPRequestFailed → HTTP_REQUEST_FAILED, APIKeyRevoked → API_KEY_REVOKED.
  • Single-word names like Paid are not matched; upper-case those yourself.

FAQ

Why were my enum members converted but not Paid?

Recognition needs at least two capitals, so one-word members are skipped to avoid changing ordinary capitalized words.

Can I go back to PascalCase later?

Yes, with the SCREAMING_SNAKE_CASE → PascalCase page. Names without acronyms come back exactly; an acronym returns in title form, so HTTP_REQUEST_FAILED goes back as HttpRequestFailed.