mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 19:57:44 +00:00
AK+Format: Support all format specifiers for strings.
The following is now possible: outf("{:.4}", "abcdef"); // abcd outf("{:*<8}", "abcdef"); // abcdef**
This commit is contained in:
parent
c0d9daadb0
commit
71b7ef0992
3 changed files with 58 additions and 9 deletions
|
@ -122,4 +122,12 @@ TEST_CASE(replacement_field)
|
|||
EXPECT_EQ(String::formatted("{:0{}}", 1, 3), "001");
|
||||
}
|
||||
|
||||
TEST_CASE(complex_string_specifiers)
|
||||
{
|
||||
EXPECT_EQ(String::formatted("{:.8}", "123456789"), "12345678");
|
||||
EXPECT_EQ(String::formatted("{:9}", "abcd"), "abcd ");
|
||||
EXPECT_EQ(String::formatted("{:>9}", "abcd"), " abcd");
|
||||
EXPECT_EQ(String::formatted("{:^9}", "abcd"), " abcd ");
|
||||
}
|
||||
|
||||
TEST_MAIN(Format)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue