+ 6
Index of arrays
How can I get the index of an array/string value? For Example: x = "Hello Bro" puts x.where_yo_at_doe['H'] #where_yo_at_doe is not a legit method but how can I make it output: 0 ? (Because H is 0 and e is 1) Does this make sense?
3 Respuestas
+ 17
puts x.index('H')
// returns 0
Source: http://stackoverflow.com/a/10668473
+ 6
@Sean Kudebeh I'm trying to get the index of H :D
@Jafca Thanks man :D
+ 2
Are you trying to get the character "e" from the string "Hello Bro" ?