how to add space when concanating two Strings in .net?
ex.
text1.text = "Hardik"
text2.text = "Patel"
string fname = text1.text + text2.text
result ="Hardikpatel" but i want "Hardik Patel"
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
venkata kumarRank #5,034 · 314 reputationPosted Jan 2, 2014, 10:18 PM EST
try this
text1.text = "Hardik"
text2.text = "Patel"
string fname = text1.text +" "+ text2.text
Sandeep Singh ShekhawatRank #147 · 15.6K reputationPosted Jan 2, 2014, 11:18 PM EST
using System;
class NameExample
{
public static void Main()
{
string fName = "Sandeep";
string lName = "Singh";
string fullName = string.Format("{0} {1}", fName, lName);
Console.WriteLine(fullName);
Console.ReadKey();
}
}
Abhay ShankerRank #375 · 6.7K reputationPosted Jan 3, 2014, 12:11 AM EST
text1.text = "Hardik"
text2.text = "Patel"
string fname = text1.text +" "+ text2.text;