it leader
[Unity3D] c# 변수형변환 int, float, string
코딩공부/Unity3D 2015. 12. 19. 16:20

c# 변수의 형변환 ( Type Convertion) 실수, 정수의 문자변환int a = 3;string str = a.ToString(); flaot b = 3.0f;string str = b.ToString(); 정수 -> 실수 변환int -> float int a = 3; float b = (float)a; 실수 -> 정수 변환float a = 3.0f;int b = (int)a; double c = 123.45; int d = (int)c; 문자열 -> 실수, 정수 변환string e = "123;string f = "123.456"; int g = int.Parse(e);float h = float.Parse(f); 또는 int g = Convert.ToInt32(e);float h = Conv..