Haskell new line character -
I need to compare windows new line character ('\ r \ n') but I
< Pre-> literal error in character / character on character '\\' ['\ r \ n']
How can I fix this?
Thank you!
The compiler is telling you that '\ r \ n' is not
A valid character should not be surprising because Windows uses two characters to indicate the end of a line, this means that you need the string
: < / P>
"\ r \ n"
This also means that you will need more complex analysis while conducting input analysis.
One way to solve is to remove all the '\ r'
characters with a simple filter, finding a sequence of two characters is a little more difficult. Can be applied to each string
in which "\ r \ n"
:
deMicrosoftifyString = filter (/ = '\ r`) Maybe
Comments
Post a Comment