Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente | ||
|
bases_programmation:operations [2017/08/07 18:26] admin [Concaténation (Texte)] |
bases_programmation:operations [2017/08/07 18:29] (Version actuelle) admin |
||
|---|---|---|---|
| Ligne 30: | Ligne 30: | ||
| ===== Concaténation (Texte) ===== | ===== Concaténation (Texte) ===== | ||
| - | ===== Opérateur + ===== | + | ==== Opérateur + ==== |
| Ligne 39: | Ligne 40: | ||
| </code> | </code> | ||
| - | ===== Méthode Concat ===== | + | ==== Méthode Concat ==== |
| <code> | <code> | ||
| - | string fullstring = string.Concat("Hello ", "World!"); | + | string firstString = "Hello"; |
| + | string secondString = "World!"; | ||
| + | string fullstring = string.Concat(firstString, secondString); | ||
| </code> | </code> | ||
| + | |||
| + | ==== Classe StringBuilder ==== | ||
| + | <code> | ||
| + | string name = "Matt"; | ||
| + | |||
| + | StringBuilder sb = new StringBuilder(); | ||
| + | sb.Append("Hello "); | ||
| + | sb.Append(name); | ||
| + | sb.Append(", comment ça va ?"); | ||
| + | |||
| + | string helloSentence = sb.ToString(); | ||
| + | </code> | ||
| + | |||
| + | |||
| ===== Comparaison ===== | ===== Comparaison ===== | ||