HELP Wanted, please.
I'm trying, with no luck, to convert a double (inches) into a string, e.g. 14.125 to 14 1/8, 0.875 to 7/8. Because of edits, I know that the fraction will always be 0 or a multiple of 1/8" (.125). That is a range of 0.0 to 0.875 for the fractional part of the double.
In Windows Visual Studio languages, this is a fairly simple task. Since I'm trying to learn Xcode and Swift 3, I can't find documentation, that I recognize, which will give me clues on how to accomplish this.
Any thoughts or ideas will be greatly appreciated!
Terry
How are you doing it in Visual Studio? It probably is very close to the code in Swift. Here is a crude example:
let i = floor(value)
let f = value - i
let s = "\(Int(i)) \(Int(rint(f*8)))/8"
Did you also want the other question answered: "How to parse a string for "." and get its index position?"?