Created
August 21, 2014 08:05
-
-
Save vbfox/6b3eb163a9beac1ba912 to your computer and use it in GitHub Desktop.
FAKE: Escape special team city comments
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let private teamCityEscapeChars = | |
[ ('\'', "|'"); ('\r', "|r"); ('\n', "|n"); ('|', "||"); ('[', "|["); (']', "|]") ] | |
|> Map.ofSeq | |
let private teamCityEscape s = | |
let final = s |> Seq.map (fun c -> | |
match teamCityEscapeChars |> Map.tryFind c with | |
| Some(replacement) -> replacement | |
| _ -> string(c) | |
) | |
String.Join("", final) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment