How can you make the latest Attoparsec match strings in a case-insensitive way?

StackOverflow https://stackoverflow.com/questions/21556754

  •  06-10-2022
  •  | 
  •  

문제

attoparsec 0.72 had this function but it seems to have disappeared in later versions:

stringTransform :: (ByteString -> ByteString) -> ByteString -> Parser ByteString

"Match a literal string, after applying a transformation to both it and the matching text. Useful for e.g. case insensitive string comparison."

http://hackage.haskell.org/package/attoparsec-0.7.2/docs/Data-Attoparsec.html

도움이 되었습니까?

해결책

Use stringCI from Data.Attoparsec.ByteString.Char8. Consider switching to Text if you want the comparison to be Unicode-aware (e.g. so that "ß" is treated as equal to "ss").

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top