Skip to main content

Description

Swaps the case of each character in a string - uppercase characters become lowercase and vice versa.

Syntax

Parameters

Returns

Type: string A new string with all uppercase characters converted to lowercase and all lowercase characters converted to uppercase. Returns null if input is null.

Examples

Example 1: Basic Usage

Output:

Example 2: Swapping Mixed Case

Output:

Notes

  • Returns null for null input
  • Non-alphabetic characters remain unchanged
  • Applies to all characters in the string, not just the first

See Also

Frequently Asked Questions

No. Numbers, punctuation, and other non-alphabetic characters remain unchanged.
It is applied to every character in the string — each uppercase letter becomes lowercase and vice versa.