5 people like it.

Simple string escaping

Simple string escaping.

1: 
let es = String.collect(function '\r'->"\\r"|'\n'->"\\n"|'\t'->"\\t"|'"'->"\\\""|c->string c)
val es : (string -> string)

Full name: Script.es
module String

from Microsoft.FSharp.Core
val collect : mapping:(char -> string) -> str:string -> string

Full name: Microsoft.FSharp.Core.String.collect
val c : char
Multiple items
val string : value:'T -> string

Full name: Microsoft.FSharp.Core.Operators.string

--------------------
type string = System.String

Full name: Microsoft.FSharp.Core.string
Raw view Test code New version

More information

Link:http://fssnip.net/5P
Posted:13 years ago
Author:fzandona
Tags: escape string char