忍者ブログ

プログラミングの練習

プログラミングの問題やプログラミング関連知識、ソフトウェアのテストについてのブログです

[PR]

×

[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。





Swift 文字列のNULL判定


こんな感じでしょうか

!/usr/bin/swift
//  String Empty

var  emptyString = ""
var  notEmptyString = "Not Empty"

if emptyString.isEmpty {
   print("emptyString is empty")
} else {
   print("emptyString is not empty")
}

if notEmptyString.isEmpty {
   print("notEmptyString  is empty")
} else {
   print("notEmptyString is not empty")
}




        
  • 1
  • 2
  • 3