searching for a substring

sashan sashang@ihug.co.nz
Thu, 08 May 2003 22:47:25 +1200


Hi

I've written a function that checks for a substring in a given string. 
This seems like a common thing to do and was wondering if there is a 
function that does this in one of the standard modules.

stringContains :: String -> String -> Bool
stringContains _ [] = True
stringContains [] _ = False
stringContains (h:t) (h1:t1) = if h == h1 then stringContains t t1 else 
stringContains t (h1:t1)

-- 
sashan
http://sashan.netfirms.com
--------------------------------------------------
Brain: Here we are, Pinky--at the dawn of time!
Pinky: Narf, Brain.  Wake me at the noon of time.