Skip to content

Commit

Permalink
AK: Implement IPv4Address::to_string_reversed()
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxWipfli authored and alimpfard committed Jun 9, 2021
1 parent a4d5745 commit d1dae5f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions AK/IPv4Address.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,15 @@ class [[gnu::packed]] IPv4Address {
octet(SubnetClass::D));
}

String to_string_reversed() const
{
return String::formatted("{}.{}.{}.{}",
octet(SubnetClass::D),
octet(SubnetClass::C),
octet(SubnetClass::B),
octet(SubnetClass::A));
}

static Optional<IPv4Address> from_string(const StringView& string)
{
if (string.is_null())
Expand Down

0 comments on commit d1dae5f

Please sign in to comment.