我有一个import SwiftUI
struct ContentView : View {
@State var length: Float = 20
var body: some View {
NavigationView {
List {
PasswordGeneratorSettings(length: $length)
}.navigationBarTitle(Text("Settings"))
}
}
}
struct PasswordGeneratorSettings : View {
@Binding var length: Float
var body: some View {
VStack(alignment: .leading) {
Slider(value: $length, from: 1, through: 512, by: 1)
Text("Password Length: \(Int(length))")
}
}
}
格式的mac address
,现在在我的80:ad:16:c5:a6:28
数据库中,下载的Mac供应商的mac id从oui
到0
。
问题是:
如何转换我的mac地址以匹配数据库中的mac地址?
答案 0 :(得分:0)
提取mac地址的前3个字节并将十六进制转换为十进制。
String mac = "80:ad:16:c5:a6:28";
String[] byteStr = mac.split(":");
int identifier = Integer.parseInt(byteStr[0],16) * 256 * 256 + Integer.parseInt(byteStr[1],16) * 256 + Integer.parseInt(byteStr[2],16);