Bonjour,

venant du monde "merveilleux" de delphi, j'avais l'habitude d'utiliser un fonction Copy qui retourne une partie d'une chaine.

Existe-il la même chose en C# ?

J'ai fait cette fonction :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
        /*
         * Copie un chaine
         */
        private String CopyString(String Source, int start, int length)
        {
            String Resultat = "";
            int i;
            int end ;
 
            if (Source.Length < (length + start))
            {
                end = Source.Length;
            }
            else
            {
                 end = length + start ;
            }
 
            for(i = start; i < end; i++)
            {
                Resultat += Source[i] ;
            }
 
            return Resultat ;
        }
Merci