String.Format 메서드
디버그 할 때나 텍스트에 값을 넣을 때 + 말고
예전 c++ 작업 할 때 처럼 포맷을 지정 해서 문자열을 만들면 편할 때가 있다.
이 때 string.Format 메소드를 사용 하면 된다.
int value = 10;
string text = "Value";
string result = string.Format("Example : {0} = {1}", text , value );
혹은
Debug.Log( string.Format("Example : {0} = {1}", text , value ) );
형식 지정 :
string s = String.Format("It is now {0:d} at {0:t}", DateTime.Now);
자리수 지정 ( 마이너스(-)는 왼쪽 정렬 ) :
String.Format("{0,-12}{1,8:yyyy}{2,12:N0}{3,8:yyyy}{4,12:N0}{5,14:P1}" , 생략.
String.Format 메서드 - Link
https://docs.microsoft.com/ko-kr/dotnet/api/system.string.format?view=netcore-3.1
String.Format 메서드 (System)
지정된 형식에 따라 개체의 값을 문자열로 변환하여 다른 문자열에 삽입 합니다.Converts the value of objects to strings based on the formats specified and inserts them into another string. String.Format 메서드를 처음 사��
docs.microsoft.com
'Unity3D' 카테고리의 다른 글
Unity3D에서 AndroidManifest.xml에 권한이나 속성을 추가 방법 (0) | 2020.06.17 |
---|---|
안드로이드에서 부팅 후 유니티 앱 자동 실행 되게 하기. (0) | 2020.06.11 |
Android Log Print Wrapper (c++) (0) | 2020.05.19 |
Curved World with Surface Shader - Rev 2 (0) | 2020.05.16 |
Open JDK 1.8 다운로드 - Open JDK 1.8 Download (0) | 2020.05.12 |