Ruby Newbie homepage Ruby Newbie homepage

How to use

Quick guide

Official content
Returns the Integer ordinal of a one-character string.
"a".ord         #=> 97
 
               static VALUE
rb_str_ord(VALUE s)
{
    unsigned int c;

    c = rb_enc_codepoint(RSTRING_PTR(s), RSTRING_END(s), STR_ENC_GET(s));
    return UINT2NUM(c);
}
            

Was this page useful?