c# string concatenation
string first = "hello_";
string second = "world";
/* Unite multiple strings to one new string*/
string third = String.Concat(first, second);
// string third will be now "hello_world"
4.2
10
public static string Concat (string str1, string str2);
Thank you!
10
0
4
2
//Java
String firstName = "BarackObama";
String lastName = " Care";
//First way
System.out.println(firstName + lastName);
//Second way
String name = firstName + lastName;
System.out.println(name);
//Third way
System.out.println("BarackObama" + " Care");
Thank you!
2
0
3.83
6
string userName = "<Type your name here>";
string dateString = DateTime.Today.ToShortDateString();
// Use the + and += operators for one-time concatenations.
string str = "Hello " + userName + ". Today is " + dateString + ".";
System.Console.WriteLine(str);
str += " How are you today?";
System.Console.WriteLine(str);
Thank you!
6
0
4
5
string str1 = "ppp";
string strRes = str1.Insert(2, "bbb");
Console.WriteLine(strRes.ToString());
Thank you!
5
0
5
1
Console.WriteLine ("text"+Var);
Thank you!
1
0
Are there any code examples left?
New code examples in category C#