Open
Description
Idea 9324276: Have String.ofChars in the standard library
Status : open
Submitted by Bang Jun-young on 8/14/2015 12:00:00 AM
10 votes
Wouldn't it be convenient if String.ofChars function was part of the standard library? The implementation is quite straightforward:
module String =
let ofSeq (seq: char seq) =
seq |> (System.Text.StringBuilder() |> Seq.fold (fun sb c -> sb.Append(c))) |> string
Currently, we have to use an inefficient chaining to convert a seq of characters to a string:
['a'; 'b'; 'c'] |> Array.ofList |> System.String
which can be simplified with String.ofChars:
['a'; 'b'; 'c'] |> String.ofChars
String.ofSeq also can be handy for profiles like PCL where the String type is not regarded as seq.
Metadata
Metadata
Assignees
Labels
No labels