bytesize is a String class method in Ruby which is used to get the length of the given string in bytes.
Parameters: Here, str is the given string.
Returns: This method returns the length of the str in bytes.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.