Skip to content

Instantly share code, notes, and snippets.

@andersonvom
Created July 10, 2012 17:34
Show Gist options
  • Save andersonvom/3084934 to your computer and use it in GitHub Desktop.
Save andersonvom/3084934 to your computer and use it in GitHub Desktop.
substring?
def substring?(s1, s2)
a = s1.size
b = s2.size
i = 0
while i <= a
x = i
j = 0
while j <= b
return true if j == b
return false if x == a
break if s1[x] != s2[j]
x += 1
j += 1
end
i += 1
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment