string-format: String.format/formatted/printf cheat sheet module (specifier anatomy, rounding vs C printf, locales, Indian lakh/crore grouping Formatter cannot do, format exceptions, %t dates, concat cost), 11 contract tests
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b7Sr2zcoRD2watXv1G
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
== conversions: what kind of value ==
|
||||
text | 42 | 3.141590 | ff | A | true
|
||||
== width: minimum characters ==
|
||||
[ ab] [ab ] [ 42] [42 ]
|
||||
== precision: digits after the point (f), or max chars (s) ==
|
||||
[3.14] [4] [ 3.142] [abc]
|
||||
== flags ==
|
||||
[00042] [+42] [-42] [ 42] [(42)] [1,234,567]
|
||||
[0xff] [010] [FF] [-003.142]
|
||||
== argument index: reuse and reorder ==
|
||||
hello world
|
||||
echo, echo and again echo
|
||||
== %n and %% ==
|
||||
100% sure
|
||||
next line
|
||||
== %s accepts anything (calls String.valueOf / toString) ==
|
||||
[null] [7] [[1, 2]] [SHOUT]
|
||||
== %b is not 'is this the string true' ==
|
||||
true true false false
|
||||
== %c takes a char or a code point ==
|
||||
A A 😀
|
||||
Reference in New Issue
Block a user