我是.NET开发人员,刚刚开始Mac和iOS应用程序开发。我在将字符串转换为BigInteger时遇到问题。非常感谢您的帮助。
这是我的C#代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Globalization;
using System.Numerics;
namespace Rextester
{
public class Program
{
public static void Main(string[] args)
{
var number = BigInteger.Parse("728faf34b64cd55c8d1d500268026ffb", NumberStyles.HexNumber);
Console.WriteLine(number); // 152278043568215137367088803326132908027
}
}
}
以下是我目前的尝试:
import Foundation
let string = "728faf34b64cd55c8d1d500268026ffb"
let array: [UInt8] = Array(string.utf8)
print(array) // [55, 50, 56, 102, 97, 102, 51, 52, 98, 54, 52, 99, 100, 53, 53, 99, 56, 100, 49, 100, 53, 48, 48, 50, 54, 56, 48, 50, 54, 102, 102, 98]