LoginSignup
0
1

More than 5 years have passed since last update.

Swift 文字型に関して

Last updated at Posted at 2015-11-02

文字型とは??と疑問を持ったため学習

Constant and variable names can contain almost any character, including Unicode characters:
定数と変数名には、Unicodeの文字を含む大抵の文字型を含めることができます。
Swiftでは、文字列を扱う型「String」、文字を扱う型「Character」が存在する。

let myString: String = "okarin" //変更できない文字列
var myString: String = "daru loved moe!!" //変更できる文字列

let myCharacter: Character = "BBA" // 変更できない文字
var myCharacter: Character = "ABB" // 変更できる文字
Swiftの文字型には、Character / UnicodeScalar / UInt8 / UInt16 / CChar がある
第一の文字型であるCharacterは他の表現では複数の値になる可能性がある
それぞれの型は暗黙の変換は原則としてできないし、明示的な変換も注意が必要

文字を扱うのにも型が複数あるんですね。

参考URL
http://qiita.com/gfx/items/e739b2d38b3a7423a86d
http://www.sololearn.com/Play/Swift 
http://inaka-gurashi.hatenablog.com/entry/%E3%83%87%E3%83%BC%E3%82%BF%E3%82%B5%E3%82%A4%E3%82%A8%E3%83%B3%E3%83%86%E3%82%A3%E3%82%B9%E3%83%88%E3%81%AB%E3%81%AA%E3%82%8B%E3%81%AB%E3%81%AF

0
1
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1