Ruby 4.0.7p0 (2026-09-15 revision 229531a6cfbf07e3caef30dbac24a2a3f3fed482)
RString Struct Reference

Ruby's String. More...

#include <rstring.h>

Data Structures

union  [union].as
 String's specific fields. More...

Data Fields

struct RBasic basic
 Basic part, including flags and class.
long len
 Length of the string, not including terminating NUL character.
union  as

Detailed Description

Ruby's String.

A string in ruby conceptually has these information:

  • Encoding of the string.
  • Length of the string.
  • Contents of the string.

It is worth noting that a string is not an array of characters in ruby. It has never been. In 1.x a string was an array of integers. Since 2.x a string is no longer an array of anything. A string is a string – just like a Time is not an integer.

Definition at line 196 of file rstring.h.

Field Documentation

◆ basic

struct RBasic RString::basic

Basic part, including flags and class.

Definition at line 199 of file rstring.h.

◆ len

long RString::len

Length of the string, not including terminating NUL character.

Note
This is in bytes.

Definition at line 206 of file rstring.h.


The documentation for this struct was generated from the following file: