Ruby | String bytes Method
bytes is a String class method in Ruby which is used to return an array of the bytes for the given string.
Syntax: str.bytes
Parameters: Here, str is the specified string.
Returns: An array of bytes.
Example 1:
Output:
83
116
114
105
110
103
Example 2:
Output:
65
66
67
68
Last Updated :
07 Jan, 2020
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...