相关疑难解决方法(0)

使用String isEmpty检查空字符串

Swift编程语言提到使用isEmpty来检查空字符串.是否存在检查字符串与""不会产生与使用isEmpty相同的结果的情况?

换一种说法:

if str.isEmpty {
 XCTAssert(str == "", "This should be true as well")
}
Run Code Online (Sandbox Code Playgroud)

文档:

通过检查其布尔值isEmpty属性,确定String值是否为空:

if emptyString.isEmpty {
    print("Nothing to see here")
}
Run Code Online (Sandbox Code Playgroud)

string swift

-3
推荐指数
1
解决办法
289
查看次数

标签 统计

string ×1

swift ×1