Ruby | String << Method Last Updated : 07 Jan, 2020 Comments Improve Suggest changes Like Article Like Report <<() is a String class method in Ruby which is used to append the given object to the string. If the object is an integer, then by default it is considered a codepoint and converted to a character before being appended. Syntax: str << "object" Parameters: Here, str is the specified string and object is appended to the string. Returns: Appended string. Example 1: Ruby #ruby 2.3.1 # Ruby program to demonstrate # the << method # Taking a string and # using the method puts "Hey " << "Champ" puts "Kirti " << 33 Output: Hey Champ Kirti ! Example 2: Ruby #ruby 2.3.1 # Ruby program to demonstrate # the << method # Taking a string and # using the method puts "Ruby " << "String" puts "Hello " << "Geeks!" Output: Ruby String Hello Geeks! Comment More infoAdvertise with us Next Article Ruby | String << Method K Kirti_Mangal Follow Improve Article Tags : Ruby Ruby-Methods Ruby String-class Similar Reads Ruby | String <=> Method <=>() is a String class method in Ruby which is used for comparisons of the strings. This method returns -1, 0, +1, or nil depending on whether the specified string is less than, equal to, or greater than other_string. Syntax: str other_string Parameters: Here, str and other_string are the str 1 min read Ruby | Set << method The << is an inbuilt method in Ruby which adds an element to the set. Syntax: s1.name << (element) Parameters: The function takes an element which is to be added to the set. Return Value: It adds an element to the set. Example 1: CPP #Ruby program to illustrate the << method #requi 1 min read Ruby | String eql? Method eql? is a String class method in Ruby which is used to check whether the strings are equal or not if they have the same length and content. Syntax: str.eql?(Other_str) Parameters: Here, str and other_str are the strings. Returns: True or false basis on the equality. Example 1: Ruby # Ruby program to 1 min read Ruby | String * Method String# * is a String class method in Ruby which is used to returns a new String containing integer copies of the receiver. Here, integer must be greater than or equal to 0. Syntax: str * Integer Parameters: Here, str is the required string and integer is the number of copies. Returns: This method r 1 min read Ruby | String + Method +() is a String class method in Ruby which is used to return a new string that contains the other specified string concatenated to the given string. Syntax: str + other_str Parameters: Here, str and other_str are the strings which are to be concatenated. Returns: Returns the concatenated string. Exa 1 min read Like