길이

    [C#] 원하는 길이로 좌측/우측 정렬시킨후 나머지 공간을 다른 문자로 채우기

    1. 원하는 길이로 좌측/우측 정렬시킨후 나머지 공간을 다른 문자로 채우기 (기본은 공백) String.PadLeft(길이, [문자]); String.PadRight(길이, [문자]); 예) string str1 = "asdf"; string str2 = str1.PadLeft(10);//str2 = " asdf" string str3 = str1.PadRight(6, '-');//str3 = "asdf--" str2 웹에서 보면 빈칸이 안나오기에 그냥 asdf로 나오지만 Length 해보면 10값 나옴