I have wondered for some time, what a nice, clean solution for joining an array of strings might look like. Example: I have [\"Alpha\", \"Beta\", \"Gamma\"] and want to join
join() function in Ruby:
join()
def join(seq, sep) seq.inject { |total, item| total << sep << item } or "" end join(["a", "b", "c"], ", ") # => "a, b, c"