module TexTables.Utils where

	import Data.List
	
	-- |Joins the element
	join :: [a] -> [[a]] -> [a]
	join d = concat . intersperse d

	-- |Maps then joins
	joinMap :: (a -> [b]) -> [b] -> [a] -> [b]
	joinMap f d = join d . map f

	-- |Adds a new line
	(+!) :: String -> String -> String
	(+!) a b = a ++ "\n" ++ b
	
	-- |Cleans a String: remove everything that is not azAZ09
	cleanString :: String -> String
	cleanString (c:cs)
		| c `elem` (['a'..'z']++['A'..'Z']++['0'..'9']) = c:(cleanString cs)
		| otherwise = cleanString cs
