StringConcatenate

La fonction construite une chaîne de caractères à partir des paramètres transmis et retourne la taille de la chaîne formée. Les paramètres peuvent avoir n'importe quel type. Il doit y avoir au minimum 2 paramètres et 64 au maximum.

int  StringConcatenate(
   string&  string_var,   // chaîne de destination
   void argument1         // premier paramètre de n'importe quel type simple 
   void argument2         // deuxième paramètre de n'importe quel type simple
   ...                    // paramètre suivant de n'importe quel type simple 
   );

Paramètres

string_var

[out]  La chaîne qui sera construite par la concaténation des paramètres suivants.

argumentN

[in]  N'importe quelles valeurs, séparées par des virgules. De 2 à 63 paramètres de n'importe quels types simples.

Valeur de Retour

Retourne la longueur de la chaîne formée par la concaténation des paramètres transformés en type string. Les paramètres seront transformés en chaînes de caractères comme dans les fonctions Print() et Comment().

Exemple :

void OnStart()
  {
//--- déclare et définit les variables participant à la concaténation
   string text="";
   string text1="This script shows how the StringConcatenate() function works.\n";
   string text2="This is the second line, at the end of which there is a line break control code.\n";
   string text3="This is line number ";
   int    num3=3;
   string text31=", the number of which is entered into the function as a separate parameter.";
   string textN="\n";
   string text4="This is line number 4, preceded by a separate parameter with a line break code.";
   int    length=StringConcatenate(texttext1text2text3num3text31textNtext4"\nLine 5 includes a real number: "0.12345);
   Print(text"\nLength of the resulting string = "length);
   
  /*
  Résultat
   This script shows how the StringConcatenate() function works.
   This is the second lineat the end of which there is a line break control code.
   This is line number 3the number of which is entered into the function as a separate parameter.
   This is line number 4preceded by a separate parameter with a line break code.
   Line 5 includes a real number0.12345
   Length of the resulting string = 358
  */
  }

Voir aussi

StringAdd, StringSplit, StringSubstr