Advertisement
Guest User

Untitled

a guest
Oct 10th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module Task2_2 where
  2.  
  3. import Data.Char (isSpace)
  4.  
  5. mySubstring xs m n = take n $ drop m xs
  6.  
  7. myTrim = dropWhile isSpace . reverse . dropWhile isSpace . reverse
  8.  
  9. split "" _ = []
  10. --split xs x = foldr f [""]
  11.  
  12. --splitBy :: Char -> String -> [String]
  13. --splitBy _ "" = [];
  14. --splitBy delimiterChar inputString = foldr f [""] inputString
  15. --  where f :: Char -> [String] -> [String]
  16. --        f currentChar allStrings@(partialString:handledStrings)
  17. --          | currentChar == delimiterChar = "":allStrings -- start a new partial string at the head of the list of all strings
  18. --          | otherwise = (currentChar:partialString):handledStrings -- add the current char to the partial string
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement