Double("123") reports "No matching overload"

How do you convert strings to Double values using Silver?
let d = Double( someString )
works fine under Linux and macOS. What do I need under Windows?

You’ll need to explicitly concert from String to double, using for example the Convert.ToDouble API in Elements RTL.

That’s really too bad. I’m working on an introductory programming book using Swift. The plan was to make it general (macOS, Windows, Linux, Raspberry Pi/Raspbian, and RockPro 64). I was hoping to use the Water IDE for the Windows side of things. This issue, however, is probably too much of a change to try to explain to absolute beginners.

I’ll see if I can add initializers for Int and Double that swill do the conversion.

that’d be really cool, and I’d be happy to do whatever we can to support this!

That would be great. Currently I’m stuck with using “Swift for Windows 2.0” which is two years out of date (Swift 4.1.3). While it compiles the first couple of examples, I’m concerned about what will happen as the book progresses.

Of course, I’m really looking forward to the problems I’ll run into when I get into Strings (and string functions). I suspect my Linux versions will break then, too.

1 Like