Method: String#downcase!
- Defined in:
- string.c
#downcase!(*options) ⇒ self?
Downcases the characters in self; returns self if any changes were made, nil otherwise:
s = 'Hello World!' # => "Hello World!"
s.downcase! # => "hello world!"
s # => "hello world!"
s.downcase! # => nil
The casing may be affected by the given options; see Case Mapping.
Related: String#downcase, String#upcase, String#upcase!.
8050 8051 8052 8053 8054 8055 8056 8057 8058 8059 8060 8061 8062 8063 8064 8065 8066 8067 8068 8069 8070 |
# File 'string.c', line 8050 static VALUE rb_str_downcase_bang(int argc, VALUE *argv, VALUE str) { rb_encoding *enc; OnigCaseFoldType flags = ONIGENC_CASE_DOWNCASE; flags = (argc, argv, flags); str_modify_keep_cr(str); enc = str_true_enc(str); if (case_option_single_p(flags, enc, str)) { if (downcase_single(str)) flags |= ONIGENC_CASE_MODIFIED; } else if (flags&ONIGENC_CASE_ASCII_ONLY) rb_str_ascii_casemap(str, str, &flags, enc); else str_shared_replace(str, rb_str_casemap(str, &flags, enc)); if (ONIGENC_CASE_MODIFIED&flags) return str; return Qnil; } |