title: Swift: Add prefix (string) into a string
body: <p>I'm looking for a <code>String</code> function that adds prefix string into an existing string.</p>
  
  <p>The problem I've is: Sometimes, I get a URL string from web service response without keyword <strong><em>http:</em></strong>.</p>
  
  <p>The general form of URL (URL string) should be: <a href="http://www.testhost.com/pathToImage/testimage.png" rel="nofollow noreferrer">http://www.testhost.com/pathToImage/testimage.png</a></p>
  
  <p>But sometimes I get <code>//www.testhost.com/pathToImage/testimage.png</code> from web service.</p>
  
  <p>Now, I know that I can check, whether prefix <code>http:</code> is there in a string or not, but if there isn't then I need to add prefix into an existing URL string.</p>
  
  <p>Is there any String (or substring or string manipulation) function that adds prefix into my URL string?</p>
  
  <p>I tried into Apple document: <a href="https://developer.apple.com/documentation/swift/string" rel="nofollow noreferrer">String</a> but couldn't find any help.</p>
  
  <p>An alternate way I have is a concatenation of string. </p>
  
  <p>Here is my code:</p>
  
  <pre><code>var imageURLString = "//www.testhost.com/pathToImage/testimage.png"
  
  if !imageURLString.hasPrefix("http:") {
     imageURLString = "http:\(imageURLString)"  // or  "http:"+ imageURLString
  }
  print(imageURLString)
  </code></pre>
  
  <p>But is there any standard way or iOS String default function that I can use here?</p>