Ruby | String codepoints Method Last Updated : 13 Dec, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report codepoints is a String class method in Ruby which is used to return an array of the Integer ordinals of the characters in str. Syntax: str.codepoints Parameters: Here, str is the given string. Returns: An array of the Integer ordinals of the characters in str. Example 1: Ruby # Ruby program to demonstrate # the codepoints method # Taking a string and # using the method puts "Ruby".codepoints Output: 82 117 98 121 Example 2: Ruby # Ruby program to demonstrate # the codepoints method # Taking a string and # using the method puts "String".codepoints Output: 83 116 114 105 110 103 Comment More infoAdvertise with us Next Article Ruby | String codepoints Method K Kirti_Mangal Follow Improve Article Tags : Ruby Ruby-Methods Ruby String-class Similar Reads Ruby | String each_codepoint Method each_codepoint is a String class method in Ruby which is used to pass the integer ordinal of each character in the given string. It is also known as a codepoint when applied to Unicode strings to the given block. An enumerator is returned if no block is given. Syntax: str.each_codepoint Parameters: 1 min read Ruby | String count() Method count is a String class method in Ruby. In this method each parameter defines a set of characters to which is to be counted. The intersection of these sets defines the characters to count in the given string. Any other string which starts with a caret ^ is negated. Syntax:str.count(parameter_list) P 1 min read Ruby | String encoding Method encoding is a String class method in Ruby which is used to return the Encoding object that represents the encoding of object. Syntax: str.encoding Parameters: Here, str is the given string. Returns: An encoding object. Example 1: Ruby # Ruby program to demonstrate # the encoding method # Taking a st 1 min read Ruby | String concat Method concat is a String class method in Ruby which is used to Concatenates two objects of String. If the given object is an Integer, then it is considered a codepoint and converted to a character before concatenation. Syntax:String_Object.concat(String_Object) Parameters: This method can take the string 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 Like