1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 05:32:54 +08:00

Move truncate() to a method body

This commit is contained in:
Lucas A 2019-12-23 10:55:44 +01:00
parent e2b4e3580c
commit 125f4286ae

View File

@ -100,7 +100,13 @@ namespace osu.Desktop
client.SetPresence(presence);
}
private string truncate(string str) => str.WithinLength(128) ? str : new string (str.TakeWhile((c, i) => Encoding.UTF8.GetByteCount(str.Substring(0, i + 1)) <= 125).ToArray()) + '…'; //the ellipsis char is 3 bytes long in UTF8
private string truncate(string str)
{
if (str.WithinLength(128))
return str;
return new string(str.TakeWhile((c, i) => Encoding.UTF8.GetByteCount(str.Substring(0, i + 1)) <= 125).ToArray()) + '…'; //the ellipsis char is 3 bytes long in UTF8
}
private string getDetails(UserActivity activity)
{