>DansTonCode();

Tous les codes sources "Mais pourquoi ?"page 10

PHP
 08 Juin, 2016 à 01:30
#273
$menu2 = array();
foreach ($menu as $i=>$m) {
    $menu2[] = $m;
 }
$menu = $menu2;
Java
 07 Juin, 2016 à 01:30
#272
    public static final String escapePl(String s){
        StringBuffer sb = new StringBuffer();
        int n = s.length();
        for (int i = 0; i < n; i++) {
         char c = s.charAt(i);
         switch (c) {
             case '?': sb.append("a"); break;
             case '?': sb.append("c"); break;
             case '?': sb.append("e"); break;
             case '?': sb.append("l"); break;
             case '?': sb.append("n"); break;
             case 'ó': sb.append("o"); break;
             case '?': sb.append("s"); break;
             case '?': sb.append("z"); break;
             case '?': sb.append("z"); break;
             case '?': sb.append("A"); break;
             case '?': sb.append("C"); break;
             case '?': sb.append("E"); break;
             case '?': sb.append("L"); break;
             case '?': sb.append("N"); break;
             case 'Ó': sb.append("O"); break;
             case '?': sb.append("S"); break;
             case '?': sb.append("Z"); break;
             case '?': sb.append("Z"); break;

            default: sb.append(c); break;
          }
       }

         return sb.toString();
     }
C#
 04 Juin, 2016 à 01:30
#269
        public string PrependZeroes(int stringLength, string str)
        {
            var sb = new StringBuilder();
            for (var ix = 0; ix < stringLength; ix++)
            {
                sb.Append("0");
            }
            sb.Append(str);
            var startIx = sb.Length - stringLength;
            if (startIx < 0)
                startIx = 0;
            return sb.ToString().Substring(startIx, stringLength);
        }