简体   繁体   中英

Checking populated array in Swift4

Keep getting error Value of type [String] has no member removeAtIndex Does any help, please? Thanks

var strings2 = ["a", "b", "c", "d"]

if strings2.isEmpty {
print("empty")

}
else {
 print("populated")                   // populated
}
strings2.insert("a", at: 0)            // Insert, not replace
print(strings2.removeAtIndex(0))          // a

该函数称为remove(at:)

print(strings2.remove(at: 0))  

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM