拆分文本值

{-# LANGUAGE OverloadedStrings #-}

import qualified Data.Text as T

myText::T.Text
myText = "mississippi"

splitOn 在出现子字符串时将 Text 分解为 Texts 列表。

ghci> T.splitOn "ss" myText
["mi","i","ippi"]

splitOnintercalate 的反转。

ghci> intercalate "ss" (splitOn "ss" "mississippi")
"mississippi"

splitText 值分解为满足布尔谓词的字符的块。

ghci> T.split (== 'i') myText
["m","ss","ss","pp",""]