Convert a list of characters (or array) to a string

前端 未结 4 733
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-07 03:57

how does one convert from a list of characters to a string?

To put it another way, how do I reverse List.ofSeq \"abcd\"?

UPDATE: new System.St

4条回答
  •  北恋
    北恋 (楼主)
    2021-02-07 04:24

    Your approach:

    new System.String (listOfChars |> List.toArray)
    

    is the solution I usually end up with too.

    F#'s grammar/type inference system simply seems unable to recognize a .NET constructor like new String as a curried function (which prevents you from using pipelining).

提交回复
热议问题