.NET Framework Class Library
StringConcat Method (String, String, String, String)

Concatenates four specified instances of String.

Namespace:   System
Assembly:  mscorlib (in mscorlib.dll)
Syntax
Public Shared Function Concat ( _
	str0 As [%$TOPIC/0eafbze3_en-us_VS_110_2_0_0_0_0%], _
	str1 As [%$TOPIC/0eafbze3_en-us_VS_110_2_0_0_0_1%], _
	str2 As [%$TOPIC/0eafbze3_en-us_VS_110_2_0_0_0_2%], _
	str3 As [%$TOPIC/0eafbze3_en-us_VS_110_2_0_0_0_3%] _
) As [%$TOPIC/0eafbze3_en-us_VS_110_2_0_0_0_4%]
public static [%$TOPIC/0eafbze3_en-us_VS_110_2_0_1_0_0%] Concat(
	[%$TOPIC/0eafbze3_en-us_VS_110_2_0_1_0_1%] str0,
	[%$TOPIC/0eafbze3_en-us_VS_110_2_0_1_0_2%] str1,
	[%$TOPIC/0eafbze3_en-us_VS_110_2_0_1_0_3%] str2,
	[%$TOPIC/0eafbze3_en-us_VS_110_2_0_1_0_4%] str3
)
public:
static [%$TOPIC/0eafbze3_en-us_VS_110_2_0_2_0_0%]^ Concat(
	[%$TOPIC/0eafbze3_en-us_VS_110_2_0_2_0_1%]^ str0, 
	[%$TOPIC/0eafbze3_en-us_VS_110_2_0_2_0_2%]^ str1, 
	[%$TOPIC/0eafbze3_en-us_VS_110_2_0_2_0_3%]^ str2, 
	[%$TOPIC/0eafbze3_en-us_VS_110_2_0_2_0_4%]^ str3
)
static member Concat : 
        str0:[%$TOPIC/0eafbze3_en-us_VS_110_2_0_3_0_0%] * 
        str1:[%$TOPIC/0eafbze3_en-us_VS_110_2_0_3_0_1%] * 
        str2:[%$TOPIC/0eafbze3_en-us_VS_110_2_0_3_0_2%] * 
        str3:[%$TOPIC/0eafbze3_en-us_VS_110_2_0_3_0_3%] -> [%$TOPIC/0eafbze3_en-us_VS_110_2_0_3_0_4%]
public static function Concat(
	str0 : [%$TOPIC/0eafbze3_en-us_VS_110_2_0_4_0_0%], 
	str1 : [%$TOPIC/0eafbze3_en-us_VS_110_2_0_4_0_1%], 
	str2 : [%$TOPIC/0eafbze3_en-us_VS_110_2_0_4_0_2%], 
	str3 : [%$TOPIC/0eafbze3_en-us_VS_110_2_0_4_0_3%]
) : [%$TOPIC/0eafbze3_en-us_VS_110_2_0_4_0_4%]

Parameters

str0
Type: SystemString

The first string to concatenate.

str1
Type: SystemString

The second string to concatenate.

str2
Type: SystemString

The third string to concatenate.

str3
Type: SystemString

The fourth string to concatenate.

Return Value

Type: SystemString
The concatenation of str0, str1, str2, and str3.
Remarks

The method concatenates str0, str1, str2, and str3; it does not add any delimiters.

An Empty string is used in place of any null object in the array.

Examples

The following example defines an array of four-letter words and stores their individual letters to a string array in order to scramble them. It then calls the Concat(String, String, String, String) method to reassemble the scrambled words.

Imports System.Collections

Module Example
   Public Sub Main()
      Const WORD_SIZE As Integer = 4

      ' Define some 4-letter words to be scrambled. 
      Dim words() As String = { "home", "food", "game", "rest" }
      ' Define two arrays equal to the number of letters in each word. 
      Dim keys(WORD_SIZE) As Double 
      Dim letters(WORD_SIZE) As String 
      ' Initialize the random number generator. 
      Dim rnd As New Random()

      ' Scramble each word. 
      For Each word As String In words
         For ctr As Integer = 0 To word.Length - 1
            ' Populate the array of keys with random numbers.
            keys(ctr) = rnd.NextDouble()
            ' Assign a letter to the array of letters.
            letters(ctr) = word.Chars(ctr)
         Next    
         ' Sort the array. 
         Array.Sort(keys, letters, 0, WORD_SIZE, Comparer.Default)      
         ' Display the scrambled word. 
         Dim scrambledWord As String = String.Concat(letters(0), letters(1), _
                                                     letters(2), letters(3))
         Console.WriteLine("{0} --> {1}", word, scrambledWord)
      Next  
   End Sub 
End Module  
' The example displays output like the following: 
'       home --> mheo 
'       food --> oodf 
'       game --> aemg 
'       rest --> trse
using System;
using System.Collections;

public class Example
{
   public static void Main()
   {
      const int WORD_SIZE = 4;

      // Define some 4-letter words to be scrambled. 
      string[] words = { "home", "food", "game", "rest" };
      // Define two arrays equal to the number of letters in each word. 
      double[] keys = new double[WORD_SIZE];
      string[] letters = new string[WORD_SIZE];
      // Initialize the random number generator.
      Random rnd = new Random();

      // Scramble each word. 
      foreach (string word in words)
      {
         for (int ctr = 0; ctr < word.Length; ctr++)
         {
            // Populate the array of keys with random numbers.
            keys[ctr] = rnd.NextDouble();
            // Assign a letter to the array of letters.
            letters[ctr] = word[ctr].ToString();
         }   
         // Sort the array. 
         Array.Sort(keys, letters, 0, WORD_SIZE, Comparer.Default);      
         // Display the scrambled word. 
         string scrambledWord = String.Concat(letters[0], letters[1], 
                                              letters[2], letters[3]);
         Console.WriteLine("{0} --> {1}", word, scrambledWord);
      } 
   }
}
// The example displays output like the following: 
//       home --> mheo 
//       food --> oodf 
//       game --> aemg 
//       rest --> trse
Version Information

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

XNA Framework

Supported in: 3.0, 2.0, 1.0

Portable Class Library

Supported in: Portable Class Library

Supported in: Windows Phone 8.1

Supported in: Windows Phone Silverlight 8.1

Supported in: Windows Phone Silverlight 8