6
4

More than 5 years have passed since last update.

printfで右詰め左詰め

Posted at

左詰め

hello.rb
printf("%-10s %s", "hello", "world");

出力

hello      world

右詰め

hello.rb
printf("%10s %s", "hello", "world");

出力

     hello world
6
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
4