Karthik Selvakumar Bhuvaneswaran is a Software Engineer working on Saas(RoR) and PaaS(Salesforce.com) applications. He beleives on day starts at night and requires nothing more than Music, a cup of cofee and a fully charged laptop.
© 2016 karthikselva. Distributed with an MIT license.
# Complexity: O((n-m+1)*m)
i = 0
j = 0
(source.length-find.length).times do |i|
find.length.times do |j|
if source[i+j] != find[j]
if j == (find.length-1)
source = "THIS IS A TEST STRING"