title: how to delete a minus sign from a string in swift
body: <p>I have an app that calculates the difference between two dates. If the user enters a Start Date that is later than the End Date, the result is a negative. This is fine. However, the string that my app produces contains two minus signs. I want to eliminate the second minus sign, so that instead of saying "-17 weeks + - 4 days" it says "-17 weeks + 4 days". </p>
  
  <p><a href="https://i.stack.imgur.com/bJ9YX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bJ9YX.png" alt="enter image description here"></a></p>
  
  <p>I need to remove the second minus sign from the result. I know that this is achieved through string manipulation but I don't know precisely how to do it. I would need to check first that the outputted string has a negative value, before implementing the string manipulation. If anyone can point me in the right direction, I would be very grateful.</p>
  
  <p>The method where I would need to implement this string manipulation to delete the 2nd minus sign is as follows:</p>
  
  <pre><code>@IBAction func calculateWeeksAndDays(sender: UIButton) {
  
      if startDateTextField.text == "" || endDateTextField == "" {
  
          let alert2 = UIAlertController(title: "Oops!", message: "Please Select an End Date!", preferredStyle: UIAlertControllerStyle.Alert)
          alert2.addAction(UIAlertAction(title: "Close", style: UIAlertActionStyle.Default, handler: nil))
          self.presentViewController(alert2, animated: true, completion: nil)
      }
      else {
  
      let start = String(startDateTextField.text!)
      let end = String(endDateTextField.text!)
      let dateFormatter = NSDateFormatter()
      dateFormatter.dateFormat = "MM-dd-yyyy"
  
  
  
          guard let startDate = dateFormatter.dateFromString(start), endDate = dateFormatter.dateFromString(end) else {
  
              return
   }
  
  
      let calendar = NSCalendar.currentCalendar()
      let components = calendar.components([.Day], fromDate: startDate, toDate: endDate, options: [])
      let days = components.day
      let weeks = components.day / 7
      let weeksanddays = days % 7
      let newString = "\(weeks) weeks + \(weeksanddays) days"
      resultWeeksAndDays.text = newString
  }
  </code></pre>
  
  <p>}</p>