What is the correct way to cast a string to an integer in Ruby?
- A string.convert(:integer)
- B int(string)
- C string.to_i
- D string.integer
Explanation
The correct answer to the question is: string.to_i
What is the correct way to cast a string to an integer in Ruby?
The correct answer to the question is: string.to_i