concat(p1)
Append—Concatenates the given object to str. If the object is a Integer, it is considered as a codepoint, and is converted to a character before concatenation.
a = "hello " a << "world" #=> "hello world" a.concat(33) #=> "hello world!"
VALUE rb_str_concat(VALUE str1, VALUE str2) { if (FIXNUM_P(str2) || TYPE(str2) == T_BIGNUM) { rb_encoding *enc = STR_ENC_GET(str1); unsigned int c = NUM2UINT(str2); int pos = RSTRING_LEN(str1); int len = rb_enc_codelen(c, enc); int cr = ENC_CODERANGE(str1); rb_str_resize(str1, pos+len); rb_enc_mbcput(c, RSTRING_PTR(str1)+pos, enc); ENC_CODERANGE_SET(str1, cr); return str1; } return rb_str_append(str1, str2); }