String Manipulations in Drupal
Drupal can help you doing this by its unicode functions.

https://api.drupal.org/api/drupal/includes%21unicode.inc/7

"ALYSSA" to "Alyssa" would be

&lt;?php
  $name = drupal_ucfirst(drupal_strtolower($name));
?&gt;


And "ENGANIO" to "E." would be:

&lt;?php
  $name = drupal_strtoupper(drupal_substr($name, 0, 1)) . '.';
?&gt;