I am manually parsing java from an API, outputting to a file, reading the file, adding data and outputting in .tex format. Everything is working perfectly EXCEPT for a single leading double quote and a trailing double quote in my final output document.tex.
The “HtmlString” should actually be “APIString” … but this is a work in progress. Names aren’t up to snuff yet.
Here is my code:
let mkStream (data:string) (filepath:string) =
use outFile = new StreamWriter(filepath)
outFile.WriteLine(sprintf "%A" data)
outFile.Close()
let (|->) (data:string) (filepath:string) =
mkStream data filepath
let (!<) (filepath:string) = new StreamReader(filepath)
HtmlString myRoute_API |-> ftext
let java = !< ftext
let javastr = java.ReadToEnd()
let jclose = java.Close()
let a = parseDirections javastr myStops
let d = publish javastr a wayptList deliveries |-> fltex
I am new to the .NET framework. However, I cant think of, off the top of my head, why the Writeline function would print the literal string instead of the string inside the quotation marks arising from the sprintf statement.
It seems like a nuance of Windows file output…there is probably a simple answer.
Re-posting my comment as an answer since it solves the problem.
Remove
sprintf "%A"fromoutFile.WriteLine(sprintf "%A" data).