Skip to content
instance method

String#concat

(*::string | ::Integer string_or_codepoints) -> self
concat(*objects) → string

Concatenates each object in objects to self; returns self:

Example
'foo'.concat('bar', 'baz') # => "foobarbaz"

For each given object object that is an integer, the value is considered a codepoint and converted to a character before concatenation:

Example
'foo'.concat(32, 'bar', 32, 'baz') # => "foo bar baz" # Embeds spaces.
'те'.concat(1089, 1090)            # => "тест"
'こん'.concat(12395, 12385, 12399)  # => "こんにちは"

Related: see Converting to New String.

See also #codepoints #count #clear #crypt also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0