본문 바로가기
Unity3D/Unity & C#

Unity & C# ~ Text 말 줄임표 표기

by 캬캬백곰 2022. 7. 1.
728x90

'나랏말씀이....'과 같이 ... 말 줄임표를 쓰는 법

string a = "abcdefg";
int textLength = 3;

void TextLengthFunc()
{
	if(a.length > textLength)
    {
    	var b = a.Substring(0, textLength) + "...";
    }
}

//출력
abc...

string.Substring(시작할 글자 index, 글자수 value) = 시작할 글자 index부터 글자수만큼 잘라냄
728x90
반응형