拆分文字值

{-# 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",""]