I have a function below which I use to format a string. The string is something like this "PT1H3M20S" which means 1 hour 3 minutes and 20 seconds. In my function, I want to format the string to 1:03:20 and it works fine but sometimes, I get the string like this "PT1H20S" which means 1 hour and 20 seconds and my function format it like this 1:20 which makes people read it as 1 minute and 20 seconds. Any suggestions?

```
func formatDuration(videoDuration: String) -> String{
    let formattedDuration = videoDuration.replacingOccurrences(of: "PT", with: "").replacingOccurrences(of: "H", with:":").replacingOccurrences(of: "M", with: ":").replacingOccurrences(of: "S", with: "")
    let components = formattedDuration.components(separatedBy: ":")
    var duration = ""
    for component in components {
        duration = duration.count > 0 ? duration + ":" : duration
        if component.count < 2 {
            duration += "0" + component
            continue
        }
        duration += component
    }
    // instead of 01:10:10, display 1:10:10
    if duration.first == "0"{
        duration.remove(at: duration.startIndex)
    }
    return duration
}

```

Call it:

```
print(formatDuration(videoDuration: "PT1H15S")

```