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:
parent
e2b4e3580c
commit
125f4286ae
@ -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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user