How to split string into only two parts with a given character in Ruby? February 19, 2023 by Tarik String#split takes a second argument, the limit. str.split(' ', 2) should do the trick.