[swift] Stringの文字数をカウント

Stringの文字数をカウント

Stringの文字数をカウントするにはStringのcharactersのcountを取得する
サンプルコード

let str = "test"
let count = str.characters.count
print(count)

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です