Skip to content

Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →

instance method

StringIO#write

(*::_ToS) -> ::Integer
strio.write(string, ...) → integer
strio.syswrite(string) → integer

Appends the given string to the underlying buffer string. The stream must be opened for writing. If the argument is not a string, it will be converted to a string using to_s. Returns the number of bytes written. See IO#write.

See also #ungetc #ungetbyte also in 4.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0