0
Why this code is not working ??
7 Respostas
+ 4
PASIVE MOB (REAL PASIVE !!)
To convert String to array, first you have to split String then convert in array like
array = "array".split('').to_a
print(array)
+ 3
.to_a changed in Ruby version 1.9 and later to no longer be valid on String.
Using "array".split("").to_a is redundant
"array".split("") alone will return the array
You can use "array".chars also.
+ 3
.chars on a String will return an array of the strings characters the same as using .split('') would.
+ 2
PASIVE MOB (REAL PASIVE !!)
You cannot convert string to array.
You can only convert string range to array like
range1 = ('a'..'d')
array = range1.to_a
print(array)
+ 1
Ok I Am AJ ! ...Thanks...😁
+ 1
Ok... Thanks...
0
ChaoticDawg .to_a = .chars ??