title: F# Convert String Array to String
body: <p>With C#, I can use <code>string.Join("", lines)</code> to convert string array to string.
  What can I do to do the same thing with F#? </p>
  
  <h2>ADDED</h2>
  
  <p>I need to read lines from a file, do some operation, and then concatenate all the lines into a single line. </p>
  
  <p>When I run this code </p>
  
  <pre><code>open System.IO
  open String
  
  let lines = 
    let re = System.Text.RegularExpressions.Regex(@"#(\d+)")
    [|for line in File.ReadAllLines("tclscript.do") -&gt;
        re.Replace(line.Replace("{", "{{").Replace("}", "}}").Trim(), "$1", 1)|]
  
  let concatenatedLine = String.Join("", lines)
  
  File.WriteAllLines("tclscript.txt", concatenatedLine)
  </code></pre>
  
  <p>I got this error</p>
  
  <pre><code>error FS0039: The value or constructor 'Join' is not defined
  </code></pre>
  
  <p>I tried this code <code>let concatenatedLine = lines |&gt; String.concat ""</code> to get this error</p>
  
  <pre><code>error FS0001: This expression was expected to have type
      string []    
  but here has type
      string
  </code></pre>
  
  <h2>Solution</h2>
  
  <pre><code>open System.IO
  open System 
  
  let lines = 
    let re = System.Text.RegularExpressions.Regex(@"#(\d+)")
    [|for line in File.ReadAllLines("tclscript.do") -&gt;
        re.Replace(line.Replace("{", "{{").Replace("}", "}}"), "$1", 1) + @"\n"|]
  
  let concatenatedLine = String.Join("", lines)
  File.WriteAllText("tclscript.txt", concatenatedLine)
  </code></pre>
  
  <p>and this one also works.</p>
  
  <pre><code>let concatenatedLine = lines |&gt; String.concat ""
  </code></pre>