I have a very long String (600+ characters) holding a big decimal value (yes I know - sounds like a BigInteger) and need the byte representation of this value.
Is there any easy way to archive this with swift?
static func decimalStringToUInt8Array(decimalString:String) -> [UInt8] {
...
}
Edit: Updated for Swift 5
I wrote you a function to convert your number string. This is written in Swift 5 (originally Swift 1.2).
Here's the reverse function. You'll notice it is very similar:
Doing a round trip test to make sure we get back to where we started:
Check that eight
255
bytes is the same asUInt64.max
: