Utile.cs 720 B

123456789101112131415161718192021222324
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. namespace CG67.FicheCollege.Domaine
  5. {
  6. public static class Utile
  7. {
  8. /// <summary>
  9. /// formate un string sous forme de prénom.
  10. /// </summary>
  11. /// <param name="str"></param>
  12. /// <returns>string formaté en type prénom, exemple : MIckAeL, retournera Mickael</returns>
  13. public static string formatStringPrenom(string str)
  14. {
  15. //Cas de sortie directe
  16. if (string.IsNullOrWhiteSpace(str)) return "";
  17. string retour = str.Substring(0, 1).ToUpper();
  18. retour += str.Substring(1, str.Length - 1).ToLower();
  19. return retour;
  20. }
  21. }
  22. }