The added whitespace is calculated based on the length of the string plus the value of the argument. : Justify Left « String « Ruby






The added whitespace is calculated based on the length of the string plus the value of the argument.


title = "AAA"
puts title.ljust 20 
puts title.rjust 25 

 

Related examples in the same category

1.Call ljust and rjust methods with an argument that is less than or equal to the length of the string