Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
11 lines (9 sloc) 288 Bytes
substr :: String -> Int -> Int -> String
substr "" _ _ = ""
substr xs s e
| e < s = undefined
| s > length xs = ""
| otherwise = take (e - s) . drop s $ xs
main = do
print $ substr "abcdef" 0 4 -- "abcd"
print $ substr "abcdef" 1 5 -- "bcde"