Created
          April 24, 2015 02:02 
        
      - 
      
- 
        Save kevinadi/ee3d4a1866c0938e3da7 to your computer and use it in GitHub Desktop. 
    Haskell: split a string using a char
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | wordsWhen :: (Char -> Bool) -> String -> [String] | |
| wordsWhen p s = case dropWhile p s of | |
| "" -> [] | |
| s' -> w : wordsWhen p s'' | |
| where (w, s'') = break p s' | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment