Skip to content
instance method

String#setbyte

[T < ::_ToInt] (::int index, T byte) -> T
setbyte(index, integer) → integer

Sets the byte at zero-based offset index to the value of the given integer; returns integer:

Example
s = 'xyzzy'
s.setbyte(2, 129) # => 129
s                 # => "xy\x81zy"

Related: see Modifying.

See also #scrub! #shellescape #scrub #shellsplit also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0