Ruby | String grapheme_clusters Method Last Updated : 12 Dec, 2019 Comments Improve Suggest changes Like Article Like Report grapheme_clusters is a String class method in Ruby which is used to return an array of grapheme clusters in the given string. Syntax: str.grapheme_clusters Parameters: Here, str is the given string. Returns: An array of grapheme clusters. Example 1: Ruby # Ruby program to demonstrate # the grapheme_clusters method # Taking a string and # using the method puts "Sample".grapheme_clusters puts "Program".grapheme_clusters Output: S a m p l e P r o g r a m Example 2: Ruby # Ruby program to demonstrate # the grapheme_clusters method # Taking a string and # using the method puts "Ruby\n".grapheme_clusters puts "String".grapheme_clusters Output: R u b y S t r i n g Comment More infoAdvertise with us Next Article Ruby | String grapheme_clusters Method K Kirti_Mangal Follow Improve Article Tags : Ruby Ruby-Methods Ruby String-class Similar Reads Ruby | String each_grapheme_cluster Method each_grapheme_cluster is a String class method in Ruby which is used to pass each grapheme cluster in the given string to the given block, or returns an enumerator if no block is given. Syntax: str.each_grapheme_cluster Parameters: Here, str is the given string. Returns: An enumerator. Example 1: Ru 1 min read Ruby | String center() method center is a String class method in Ruby which is used to centers the given string in width. If the specified width is greater than the length of the given string, then this method will return a new string of the specified width with the given string centered and padded otherwise it returns only give 1 min read Ruby | String each_byte Method each_byte is a String class method in Ruby which is used to passes each byte in the given string to the given block or returns an enumerator if no block is given. Syntax: str.each_byte {|integer| block } Parameters: Here, str is the given string. Returns: An enumerator. Example 1: Ruby # Ruby progra 1 min read Ruby | String crypt Method crypt is a String class method in Ruby which is used to returns the string generated by calling crypt(3) standard library function with str and salt_str. Syntax: crypt(salt_str)-> new_str Parameters: Here, str is the given string and salt_str is the specified salt for crypt method. Example 1: Rub 1 min read Ruby | String each_line Method each_line is a String class method in Ruby which is used to split the given string sing the supplied parameter as the record separator ($/ by default), passing each substring in turn to the supplied block. The string is split into paragraphs delimited by multiple successive newlines if a zero-length 1 min read Like