How do you trim whitespace from the start and end of a string?
trim \" abc \"
=>
\"abc\"
Edit:
Ok, let me be a little cleare
You can combine Data.Text
's strip
with it's un/packing functions to avoid having overloaded strings:
import qualified Data.Text as T
strip = T.unpack . T.strip . T.pack
lstrip = T.unpack . T.stripStart . T.pack
rstrip = T.unpack . T.stripEnd . T.pack
Testing it:
> let s = " hello "
> strip s
"hello"
> lstrip s
"hello "
> rstrip s
" hello"