Skip to content

Instantly share code, notes, and snippets.

@tw-Frey
Created December 4, 2017 02:55
Show Gist options
  • Select an option

  • Save tw-Frey/7eb21b103e2d23573f0a628bfac15875 to your computer and use it in GitHub Desktop.

Select an option

Save tw-Frey/7eb21b103e2d23573f0a628bfac15875 to your computer and use it in GitHub Desktop.
自己習慣的 versionName 格式
versionName String.format("%.0f.%d", versionCode / 16 + 0.49, (versionCode + 15) % 16)
在 String.format 的 %.0f 會把 1.5 四捨五入 為 2.0
(但 17/16+0.4 轉 %.0f 還是 1 ?!)
P.S. 17/16 = 1.0625
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment