1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2026-01-17 19:30:59 +00:00

AK: Add String::number() for creating a String from a number.

Instead of manually doing String::format("%d"/"%u") everywhere, let's have
a String API for this. It's just a wrapper around format() for now, but it
could be made more efficient in the future.
This commit is contained in:
Andreas Kling 2019-07-03 14:56:27 +02:00
parent 8ac2b30de7
commit b79112e6d6
11 changed files with 26 additions and 14 deletions

View file

@ -202,7 +202,7 @@ String GDirectoryModel::name_for_uid(uid_t uid) const
{
auto it = m_user_names.find(uid);
if (it == m_user_names.end())
return String::format("%u", uid);
return String::number(uid);
return (*it).value;
}
@ -210,7 +210,7 @@ String GDirectoryModel::name_for_gid(uid_t gid) const
{
auto it = m_user_names.find(gid);
if (it == m_user_names.end())
return String::format("%u", gid);
return String::number(gid);
return (*it).value;
}