APIdock / Ruby
/
method

ljust

ruby latest stable - Class: String
ljust(*args)
public

If integer is greater than the length of str, returns a new String of length integer with str left justified and padded with padstr; otherwise, returns str.

"hello".ljust (4) #=> "hello"
"hello".ljust (20) #=> "hello "
"hello".ljust (20, '1234') #=> "hello123412341234123"
static VALUE
rb_str_ljust(int argc, VALUE *argv, VALUE str)
{
 return rb_str_justify(argc, argv, str, 'l');
}

AltStyle によって変換されたページ (->オリジナル) /