Mega Code Archive
Categories
/
Ruby
/
String
The index method returns the index location of a matching substring
So if you use index like this: line = "A horse! a horse! my kingdom for a horse!" puts line.index("k")