title: How can I use String substring in Swift 4? 'substring(to:)' is deprecated: Please use String slicing subscript with a 'partial range from' operator
body: <p>I have the following simple code written in Swift 3:</p>
  
  <pre><code>let str = "Hello, playground"
  let index = str.index(of: ",")!
  let newStr = str.substring(to: index)
  </code></pre>
  
  <p>From Xcode 9 beta 5, I get the following warning:</p>
  
  <blockquote>
    <p>'<code>substring(to:)</code>' is deprecated: Please use <code>String</code> slicing subscript with a 'partial range from' operator.</p>
  </blockquote>
  
  <p>How can this <strong>slicing subscript with partial range from</strong> be used in Swift 4?</p>