Take the 2-minute tour ×

In C# I can use:

string myBigString = @"

  <someChild />


How to do this in F#?

share|improve this question

3 Answers 3

up vote 7 down vote accepted

In F# 3.0, VS 2012, support was added for triple-quoted strings.

In a triple-quoted string, everything between triple-quotes ("""...""") is kept verbatim; there is no escaping at all. As a result, if I want to have a bit of XAML as a string literal, it’s easy:

let xaml = """ 
  <Border BorderThickness="15.0" BorderBrush="Black"> 
    <StackPanel Name="stackPanel1"> 
      <TextBlock Text="Super BreakAway!" FontSize="24" HorizontalAlignment="Center" /> 
      <TextBlock Text="written in F#, by Brian McNamara - press 'p' to pause" 
                 FontSize="12" HorizontalAlignment="Center" /> 
      <Border BorderThickness="2.0" BorderBrush="Black"> 
        <Canvas Name="canvas" Background="White" /> 
share|improve this answer

If preceded by the @ symbol, the literal is a verbatim string. This means that any escape sequences are ignored, except that two quotation mark characters are interpreted as one quotation mark character.

Source: Strings (F#)

share|improve this answer

Try just :

let str1 = "abc
let str2 = "abc\

For more information see: http://msdn.microsoft.com/en-us/library/362314fe.aspx

share|improve this answer

Your Answer


