Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
lainsce committed Jan 20, 2023
1 parent d065584 commit aff3732
Showing 1 changed file with 10 additions and 19 deletions.
29 changes: 10 additions & 19 deletions lib/Widgets/Avatar.vala
Original file line number Diff line number Diff line change
Expand Up @@ -109,27 +109,18 @@ public class He.Avatar : He.Bin {
}

private string extract_initials (string t) {
string i = "";
string p = t.up (-1);
string n = p._strip ().normalize (-1, GLib.NormalizeMode.DEFAULT_COMPOSE);
string u;
string q = "";
string ret = "";

if (n == null)
if (t.length == 0)
return "";

u = n;
i += u;

q = n.rchr (-1, ' ');
if (q != "") {
u = q;

if (u != "")
i += u;
}

return i;

ret += t[0].to_string ().up ();

for (int i = 1; i < t.length - 1; i++)
if (t[i] == ' ')
ret += t[i+1].to_string ().up ();

return ret;
}


Expand Down

0 comments on commit aff3732

Please sign in to comment.