Explorar o código

FIX Problème de prénom de contact vide

julien.legrand %!s(int64=8) %!d(string=hai) anos
pai
achega
9ed05a9039
Modificáronse 1 ficheiros con 3 adicións e 0 borrados
  1. 3 0
      Core/CG67.FicheCollege.Domaine/Utile.cs

+ 3 - 0
Core/CG67.FicheCollege.Domaine/Utile.cs

@@ -13,6 +13,9 @@ namespace CG67.FicheCollege.Domaine
         /// <returns>string formaté en type prénom, exemple : MIckAeL, retournera Mickael</returns>
         public static string formatStringPrenom(string str)
         {
+            //Cas de sortie directe
+            if (string.IsNullOrWhiteSpace(str)) return "";
+
             string retour = str.Substring(0, 1).ToUpper();
             retour += str.Substring(1, str.Length - 1).ToLower();
             return retour;