Skip to content

Instantly share code, notes, and snippets.

@aeg
Created October 14, 2013 09:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aeg/6973014 to your computer and use it in GitHub Desktop.
Save aeg/6973014 to your computer and use it in GitHub Desktop.
0埋めの文字列として出力する
def str="1"
// Case #1
// 0埋めの文字列として出力する
assert "001"==str.padLeft(3, "0")
// Case #2
// 空白文字で左埋めするには(埋める文字列を指定しないと空白になる)
assert " 1"==str.padLeft(3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment