I’m having trouble generating a file reference in F# from a substring.
I have an input file and I want to create a uniquely identifiable output file from a truncation of the input file name.
My code is as follows:-
let sillyString = @"BookingsAberdeen.csv";;
let cutString = sillyString.Substring(8);;
let outputFile = "@" + cutString;;
outputFile;;
But it is not coming out quite right. I’m getting “@Aberdeen.csv”, but I need it to be @”Aberdeen.csv”.
Can anyone advise as to the correct code to use for outputFile?
Many thanks,
Simon
EDIT: Removed unneccesary test line from the code.
@is the verbatim string modifier.It stops F# from interpreting e.g.
"c:\test.txt"as"c:[TAB]est.txt". Once the string has been interpreted correctly, you don’t need to worry about @-ing it – just remove"@" +from the fourth line.