Ruby Language Joining Strings


Example

Array#join joins an Array into a String, based on a delimiter:

["alpha", "beta"].join(",")
# => "alpha,beta"

The delimiter is optional, and defaults to an empty String.

["alpha", "beta"].join
# => "alphabeta"

An empty Array results in an empty String, no matter which delimiter is used.

[].join(",")
# => ""