VOOZH about

URL: https://apidock.com/ruby/String/swapcase

⇱ String#swapcase - APIdock


method

swapcase

ruby latest stable - Class: String
swapcase(*args)
public

Returns a copy of str with uppercase alphabetic characters converted to lowercase and lowercase characters converted to uppercase.

See String#downcase for meaning of and use with different encodings.

"Hello".swapcase #=> "hELLO"
"cYbEr_PuNk11".swapcase #=> "CyBeR_pUnK11"
static VALUE
rb_str_swapcase(int argc, VALUE *argv, VALUE str)
{
 str = rb_str_dup(str);
 rb_str_swapcase_bang(argc, argv, str);
 return str;
}

Related methods