mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:38:11 +00:00
AK: Made Strings reversible
`AK::String` can now be reversed via AK::String::reverse(). This makes life a lot easier for functions like `itoa()`, where the output ends up being backwards. Very much not like the normal STL (which requires an `std::reverse` object) way of doing things. A call to reverse returns a new `AK::String` so as to not upset any of the possible references to the same `StringImpl` shared between Strings.
This commit is contained in:
parent
093961d2d9
commit
26e81ad574
4 changed files with 28 additions and 4 deletions
|
@ -41,6 +41,7 @@ TEST_CASE(compare)
|
|||
EXPECT(!("a" >= String("b")));
|
||||
EXPECT("a" <= String("a"));
|
||||
EXPECT(!("b" <= String("a")));
|
||||
EXPECT(!strcmp(test_string.reversed().characters(), "FEDCBA"));
|
||||
}
|
||||
|
||||
TEST_CASE(index_access)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue