-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add format function for storage sizes
- Loading branch information
1 parent
a94b5dc
commit f7fb8d1
Showing
4 changed files
with
125 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
toUpper: J | ||
toUpper: THIS IS A TEST. | ||
toLower: l | ||
toLower: this is a test. | ||
capizalize: Word | ||
formatStorageSize: 1.000000 B | ||
formatStorageSize: 1.000000 B | ||
formatStorageSize: 1.230000 KB | ||
formatStorageSize: 1.210000 KiB | ||
formatStorageSize: 1.230000 MB | ||
formatStorageSize: 1.180000 MiB | ||
formatStorageSize: 1.230000 GB | ||
formatStorageSize: 1.150000 GiB | ||
formatStorageSize: 1.230000 TB | ||
formatStorageSize: 1.120000 TiB | ||
formatStorageSize: 1.230000 PB | ||
formatStorageSize: 1.100000 PiB | ||
formatStorageSize: 1.230000 EB | ||
formatStorageSize: 1.070000 EiB |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import "std/text/format"; | ||
|
||
f<int> main() { | ||
printf("toUpper: %c\n", toUpper('j')); | ||
printf("toUpper: %s\n", toUpper(String("This is a test."))); | ||
printf("toLower: %c\n", toLower('L')); | ||
printf("toLower: %s\n", toLower(String("This is a test."))); | ||
printf("capizalize: %s\n", capitalize(String("word"))); | ||
|
||
printf("formatStorageSize: %s\n", formatStorageSize(1l)); | ||
printf("formatStorageSize: %s\n", formatStorageSize(1l, true)); | ||
printf("formatStorageSize: %s\n", formatStorageSize(1234l)); | ||
printf("formatStorageSize: %s\n", formatStorageSize(1234l, true)); | ||
printf("formatStorageSize: %s\n", formatStorageSize(1234567l)); | ||
printf("formatStorageSize: %s\n", formatStorageSize(1234567l, true)); | ||
printf("formatStorageSize: %s\n", formatStorageSize(1234567890l)); | ||
printf("formatStorageSize: %s\n", formatStorageSize(1234567890l, true)); | ||
printf("formatStorageSize: %s\n", formatStorageSize(1234567890123l)); | ||
printf("formatStorageSize: %s\n", formatStorageSize(1234567890123l, true)); | ||
printf("formatStorageSize: %s\n", formatStorageSize(1234567890123456l)); | ||
printf("formatStorageSize: %s\n", formatStorageSize(1234567890123456l, true)); | ||
printf("formatStorageSize: %s\n", formatStorageSize(1234567890123456789l)); | ||
printf("formatStorageSize: %s\n", formatStorageSize(1234567890123456789l, true)); | ||
} |