본문 바로가기
삽질/Ruby

[Ruby] 빈 공간 텍스트 채우기

by 푸딩s 2014. 11. 28.


"hello".ljust(4)                  #=> "hello"

"hello".ljust(20)                #=> "hello               "

"hello".ljust(20, '1234')    #=> "hello123412341234123"


"hello".rjust(20, '1234')    #=> "123412341234123hello"


'삽질 > Ruby' 카테고리의 다른 글

[Ruby] Time 비교하기  (0) 2014.11.26
[Ruby] File Time  (0) 2014.11.26
[Ruby] html 예제  (0) 2014.11.26

댓글