Method: String#downcase
- Defined in:
- string.c
#downcase(*options) ⇒ String
Returns a string containing the downcased characters in self:
s = 'Hello World!' # => "Hello World!"
s.downcase # => "hello world!"
The casing may be affected by the given options; see Case Mapping.
Related: String#downcase!, String#upcase, String#upcase!.
8089 8090 8091 8092 8093 8094 8095 8096 8097 8098 8099 8100 8101 8102 8103 8104 8105 8106 8107 8108 8109 8110 8111 8112 |
# File 'string.c', line 8089 static VALUE rb_str_downcase(int argc, VALUE *argv, VALUE str) { rb_encoding *enc; OnigCaseFoldType flags = ONIGENC_CASE_DOWNCASE; VALUE ret; flags = (argc, argv, flags); enc = str_true_enc(str); if (case_option_single_p(flags, enc, str)) { ret = rb_str_new(RSTRING_PTR(str), RSTRING_LEN(str)); str_enc_copy_direct(ret, str); downcase_single(ret); } else if (flags&ONIGENC_CASE_ASCII_ONLY) { ret = rb_str_new(0, RSTRING_LEN(str)); rb_str_ascii_casemap(str, ret, &flags, enc); } else { ret = rb_str_casemap(str, &flags, enc); } return ret; } |