Skip to content

Instantly share code, notes, and snippets.

@veer66
Created April 25, 2013 16:43
Show Gist options
  • Save veer66/5461215 to your computer and use it in GitHub Desktop.
Save veer66/5461215 to your computer and use it in GitHub Desktop.
Haskell มันไม่มี substr ใน standard library จริงหรือ เกรงว่าผมจะหาไม่เจอเอง แต่โปรแกรมนี้ทำงานถูกก็ใช้การได้แล้ว
substr :: [Char] -> Int -> Int -> [Char]
substr str start end =
let length' = end - start
in (take length' (drop start str))
main = do
x <- readFile "u8.txt"
putStrLn (substr x 3 8)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment