Case

The case function takes a string and a type as parameters, and returns a modified version of the string based on the specified type. The type parameter is mandatory and must be one of the following values:

  • upper: converts the string to uppercase
  • lower: converts the string to lowercase
  • capitalize: capitalizes the first letter of the string

Parameters

  • string: the string to be modified
  • type: the type of modification to be applied to the string. Must be one of upper, lower, or capitalize.

Examples

case("hello", type="upper")

returns: "HELLO"

case("HELLO", type="lower")

returns: "hello"

case("hELLO", type="capitalize")

returns: "Hello"