Open klequis opened 2 years ago
If using Data.Text you can use strip, stripStart and stripEnd to trim text. If not using Data.Text I looked for a solution and liked this on the best:
Data.Text
strip
stripStart
stripEnd
import Data.Char (isSpace) import Data.List (dropWhileEnd) trimLeft :: String -> String trimLeft = dropWhile isSpace trimRight :: String -> String trimRight = dropWhileEnd isSpace trim :: String -> String trim = trimLeft . trimRight
If using
Data.Text
you can usestrip
,stripStart
andstripEnd
to trim text. If not usingData.Text
I looked for a solution and liked this on the best: