Ruby | String delete_suffix Method Last Updated : 03 Mar, 2023 Summarize Comments Improve Suggest changes Share Like Article Like Report delete_suffix is a String class method in Ruby which is used to return a a copy of the given string with trailing suffix deleted. Syntax: str.delete_suffix Parameters: Here, str is the given string. Returns: A copy of the given string with trailing suffix deleted. Example 1: Ruby # Ruby program to demonstrate # the delete_suffix method # Taking a string and # using the method puts "Ruby".delete_suffix("by") puts "Class".delete_suffix("s") Output: Ru Class Example 2: Ruby # Ruby program to demonstrate # the delete_suffix method # Taking a string and # using the method puts "Sample".delete_suffix("pl") puts "Input".delete_suffix("ut") Output: Sample Inp Comment More infoAdvertise with us Next Article Ruby | String delete_suffix Method K Kirti_Mangal Follow Improve Article Tags : Ruby Ruby-Methods Ruby String-class Similar Reads Ruby | String delete_suffix! Method delete_suffix! is a String class method in Ruby which is used to return a copy of the given string with trailing suffix deleted or nil if no change was made. Syntax:str.delete_suffix! Parameters: Here, str is the given string. Returns: A copy of the given string with trailing suffix deleted or nil i 1 min read Ruby | String delete() Method delete is a String class method in Ruby which is used to return a copy of the given string with all characters in the intersection of its arguments deleted. Syntax: str.delete(parameter_list) Parameters: Here, str is the given string and parameter_list are the specified characters. Returns: A new co 1 min read Ruby | String delete! Method delete! is a String class method in Ruby which is used to perform a delete operation, returning the given string, or nil if the given string was not modified. Syntax: str.delete!(parameter_list) Parameters: Here, str is the given string and parameter_list are the specified characters. Returns: nil i 1 min read Ruby | String delete_prefix Method delete_prefix is a String class method in Ruby which is used to return a a copy of the given string with leading prefix deleted. Syntax: str.delete_prefix Parameters: Here, str is the given string. Returns: A copy of the given string with leading prefix deleted. Example 1: Ruby # Ruby program to dem 1 min read Ruby | String delete_prefix! Method delete_prefix! is a String class method in Ruby which is used to return a a copy of the given string with leading prefix deleted or nil if no change was made. Syntax: str.delete_prefix Parameters: Here, str is the given string. Returns: A copy of the given string with leading prefix deleted or nil i 1 min read Like