StringConcatenate

Формирует строку из переданных параметров и возвращает размер сформированной строки. Параметры могут иметь любой тип. Количество параметров не может быть меньше 2 и не может превышать 64.

int  StringConcatenate(
   string&  string_var,   // строка для формирования
   void argument1         // первый параметр любого простого типа 
   void argument2         // второй параметр любого простого типа
   ...                    // следующий параметр любого простого типа
   );

Параметры

string_var

[out]  Строка, которая будет сформирована в результате конкатенации.

argumentN

[in]  Любые значения, разделенные запятыми. От 2 до 63 параметров любого простого типа.

Возвращаемое значение

Возвращает длину строки,  сформированной путем конкатенации преобразованных в тип string параметров. Параметры преобразуются в строки по тем же правилам, что и в функциях Print() и Comment().

Пример:

void OnStart()
  {
//--- объявляем и определяем переменные, участвующие в конкатенации
   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);
   
   /*
   Результат
   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
   */
  }

Смотри также

StringAdd, StringSplit, StringSubstr