16th Mar 2021, 9:03 AM
Carbon dioxide
Carbon dioxide - avatar
7 Antworten
+ 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)
16th Mar 2021, 9:20 AM
A͢J
A͢J - avatar
+ 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.
16th Mar 2021, 9:27 AM
ChaoticDawg
ChaoticDawg - avatar
+ 3
.chars on a String will return an array of the strings characters the same as using .split('') would.
16th Mar 2021, 9:45 AM
ChaoticDawg
ChaoticDawg - avatar
+ 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)
16th Mar 2021, 9:18 AM
A͢J
A͢J - avatar
+ 1
Ok I Am AJ ! ...Thanks...😁
16th Mar 2021, 9:21 AM
Carbon dioxide
Carbon dioxide - avatar
+ 1
Ok... Thanks...
16th Mar 2021, 9:46 AM
Carbon dioxide
Carbon dioxide - avatar
0
ChaoticDawg .to_a = .chars ??
16th Mar 2021, 9:42 AM
Carbon dioxide
Carbon dioxide - avatar