Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

ircmd

import Foundation
var strCommand = "1,2,123456799,10,65535,65536"
var cmd_int:[Int] = []
var cmd_int_16:[UInt16] = []
var ir_Cmd = strCommand.components(separatedBy:",")

if ir_Cmd.count > 0 {
    cmd_int = ir_Cmd.map{Int($0) ?? 0}
    cmd_int_16 = cmd_int.map{UInt16(littleEndian: UInt16(truncatingIfNeeded:$0))}
}

print(ir_Cmd)
print(cmd_int)
print(cmd_int_16)

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.