String 如何在不取出用于拆分的字符的情况下拆分f#中的字符串

String 如何在不取出用于拆分的字符的情况下拆分f#中的字符串,string,types,f#,functional-programming,String,Types,F#,Functional Programming,我正在尝试使用一个字符串,比如“hello world:bye world”,然后获取[“hello world”;:“;“bye world”]这是我能想到的通过测试用例的最简单函数 let split (str:string) = str.Split ':' |> Seq.collect(fun x -> [":"; x.Trim()]) |> Seq.tail |> Seq.toList split "hello world : b

我正在尝试使用一个字符串,比如
“hello world:bye world”
,然后获取
[“hello world”;:“;“bye world”]

这是我能想到的通过测试用例的最简单函数

let split (str:string) =
    str.Split ':'
    |> Seq.collect(fun x -> [":"; x.Trim()])
    |> Seq.tail
    |> Seq.toList

split "hello world : bye world" // ["hello world"; ":"; "bye world"]