I use this little function to truncate strings when needed:
function truncate_text($text, $nbrChar = 55, $append='...') {
if (strlen($text) > $nbrChar) {
$text = substr($text, 0, $nbrChar);
$text .= $append;
}
return $text;
}
I would like some help to create a new function to truncate email local-parts similar to what is done in Google Groups.
abc...@gmail.com
This would be especially useful for users using Facebook's proxy email.
apps+2189712.12457.7b00f3c9e8bfabbeea8f73@proxymail.facebook.com
I guess this new function would use regex to find the @
and then truncate the local-part to a certain number of characters to generate something like
apps+21...@proxymail.facebook.com
Any suggestions how to tackle this?
Thanks!