Question: I simply would like to convert a `String` into a `Double` . This is the function I am using for this:

```
private func calculateListPrice(index: Int) -> Double {
    var price = Double(0.0)
    for wish in self.dataSourceArray[index].wishes {
        var priceTrimmed = wish.price.trimmingCharacters(in: CharacterSet(charactersIn: "0123456789.").inverted)
        priceTrimmed = priceTrimmed.replacingOccurrences(of: ",", with: ".")
        print(priceTrimmed)
        if let doublePrice = Double(priceTrimmed) {
            price += doublePrice
            // return value * 100 so updateAmount calculates correct Int Value
        }
    }
    let rounded = Double(round(100*price)/100)
    print(rounded)
    return rounded
}

```

The problem is that this not working with every number. Here are a free example:

> 
> no: 999.999.99
> 
> 
> yes: 2.22
> 
> 
> yes: 505.05
> 
> 
> yes: 31.11
> 
> 
> no: 3.111.50
> 
> 
> yes: 999.99
> 
> 
> no: 2.000.00
> 
> 
>

Answer: 
You need to convert the inputs to `int`. By default, input values are string

```
value = int(input("Please enter a string:\n"))
value2 = int(input("Please enter a string:\n"))
value3 = value+value2
print(f'You entered {value+value2}')
print(f'You entered {value3}')

```
Since the inputs are strings by default so if you want integers you need to convert as done below :

```
value1 = int(input("Please enter a string:\n"))
value2 = int(input("Please enter a string:\n"))

```