please tell me how to display output

Posted by Gow.net under C# on 2/10/2012 | Points: 10 | Views : 1110 | Status : [Member] | Replies : 6
My input
"dotnet" and "FUNDA"
how to display above input to following format
" dFoUtNnDeAt "

gowthaman8870226416


Responses

Posted by: Ogipansrk on: 2/10/2012 [Member] Starter | Points: 25

Up
0
Down
string str1 = "dotnet";
string str2 = "funda";
char[] arr1 = str1.ToCharArray();
char[] arr2 = str2.ToCharArray();
StringBuilder sb = new StringBuilder();
int counter =0;

for (int i = 0; i <= arr1.Length-1; i++)
{
sb.Append(arr1[i]);
for (int j = i; j <= i; j++)
{
if (counter <= 0)
{
if (j == arr2.Length)
{
counter++;

}
else
{
sb.Append(arr2[j]);
}
}

}

}

Gow.net, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sksamantaray on: 2/10/2012 [Member] Silver | Points: 25

Up
0
Down
string str1="dotnet";

string str2 = "FUNDA";
string res="";
for (int i = 0; i < str1.Length; i++)
{
char x;
if (i == str2.Length)
x=' ';
else
x=str2[i];



res =res+ str1[i] + x;

}
Response.Write(res.Trim().ToString());


Thanks,
Sanjay

Gow.net, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Gow.net on: 2/11/2012 [Member] Starter | Points: 25

Up
0
Down
hi Sksamantaray sir

str2 variable string data type bu x is char data type
it possible x=str2;
i got error message sir

gowthaman8870226416

Gow.net, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Gow.net on: 2/11/2012 [Member] Starter | Points: 25

Up
0
Down
hi Ogipansrk sir

how to disply my out put tell me sir

gowthaman8870226416

Gow.net, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ogipansrk on: 2/11/2012 [Member] Starter | Points: 25

Up
0
Down
Gowtham,

The code which i posted will work for you.


Gow.net, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sksamantaray on: 2/11/2012 [Member] Silver | Points: 25

Up
0
Down
 string str1="dotnet";

string str2 = "FUNDA";
string res="";
for (int i = 0; i < str1.Length; i++)
{
char x;
if (i == str2.Length)
x=' ';
else
x=str2[i];



res =res+ str1[i] + x;

}
Response.Write(res.Trim().ToString());


Hi ,
try this.

Thanks,
Sanjay

Gow.net, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response