first commit
This commit is contained in:
parent
275f1bb6d2
commit
469de83cdc
1 changed files with 10 additions and 1 deletions
11
Library.fs
11
Library.fs
|
|
@ -21,9 +21,18 @@ module Rprint =
|
|||
let original = printer.Value
|
||||
|
||||
// Bind om till StringBuilder
|
||||
printer.Value <- fun s -> sb.AppendLine s |> ignore
|
||||
printer.Value <- fun s -> sb.Append s |> ignore
|
||||
try
|
||||
f ()
|
||||
sb.ToString().TrimEnd()
|
||||
finally
|
||||
printer.Value <- original
|
||||
|
||||
let withOutputToStringBuilder (builder: System.Text.StringBuilder) f =
|
||||
let original = printer.Value
|
||||
|
||||
printer.Value <- (fun s -> builder.Append(s) |> ignore)
|
||||
try
|
||||
f ()
|
||||
finally
|
||||
printer.Value <- original
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue