How would I display initials of a variable (example name app variable) like google?

So what I want to achieve is to get initial letter from a variable, let it be email address or name, surname etc. Just the first letter/number?
So for example user's email address is [email protected], how would I get the first letter J from that and display it?
I basically want to fake avatars if one's not set. Thanks!

1
1 reply