Bonjour,
j'ai fait un code en c# , pour supprimer toutes les espaces en trop;
mais ca marche pas ,
Pourquoi ?
Merci de m'aider.
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39 using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication6 { class Program { static void Main(string[] args) { int i = 0; string a = " Bonne nouvelle dans la lutte contre la maladie dAlzheimer. "; //a = "Bonne nouvelle dans la lutte contre la maladie dAlzheimer."; while (i < a.Length) { if (a[i] == ' ') { int j = i + 1; if (a[j] == ' ') { while (a[j] == ' ') { a = a.Replace(a[j], '\0'); j = j + 1; ; } i = j; } else i++; } else i++; } Console.WriteLine(a); Console.ReadKey(); } } }
Partager