Format sizes to human readable format.
这个玩意儿是 Project Rhinestone 的副产品, 顺手把能支持的标准和格式都尽量支持了.
Features
* 2 standards: Decimal (1000), Binary (1024);
* 9 prefixes: none, K, M, G, T, P, E, Z, Y;
* 4 prefix types (expanded & abbreviated): Hybrid (used by Apple), Metric, JEDEC, IEC;
* 2 base units (expanded & abbreviated): byte (B), bit (b);
* Customizable available prefixes range;
* Customizable abbrev cap;
* Customizable number of digits after decimal point;
* Customizable option for trimming trailing zeros after decimal point;
* Customizable option for whether to use "Zero" to replace "0" when the size is 0.
ref:
https://github.com/AlexRezit/PRSizeFormatter
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
https://www.v2ex.com/t/93459
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.