Ruby | String delete_prefix Method Last Updated : 13 Dec, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report 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 demonstrate # the delete_prefix method # Taking a string and # using the method puts "Ruby".delete_prefix("Ru") puts "Class".delete_prefix("Cl") Output: by ass Example 2: Ruby # Ruby program to demonstrate # the delete_prefix method # Taking a string and # using the method puts "Sample".delete_prefix("am") puts "Input".delete_prefix("In") Output: Sample put 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_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 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_suffix Method 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 1 min read 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 Clear Method clear is a String class method in Ruby which is used to make the string empty. Syntax: str.clear Parameters: Here, str is the given string. Return : An empty string. Example 1: Ruby # Ruby program to demonstrate # the clear method # Taking a string and # using the method puts "String".clea 1 min read Like