Method: String#each_codepoint

Defined in:
string.c

#each_codepoint {|integer| ... } ⇒ String #each_codepointObject

Passes the Integer ordinal of each character in str, also known as a codepoint when applied to Unicode strings to the given block.

If no block is given, an enumerator is returned instead.

"hello\u0639".each_codepoint {|c| print c, ' ' }

produces:

104 101 108 108 111 1593

Overloads:

  • #each_codepoint {|integer| ... } ⇒ String

    Yields:

    • (integer)

    Returns:



7406
7407
7408
7409
7410
# File 'string.c', line 7406

static VALUE
rb_str_each_codepoint(VALUE str)
{
    return rb_str_enumerate_codepoints(str, 0);
}