protected void Page_Load(object sender, EventArgs e)
{
string name = "Testpr";
string newname = "";
StringBuilder sb = new StringBuilder();
for (int i = 0; i < 6; i++)
{
string textname = name[i].ToString(); // Get Character one by one
if ((i % 2) == 0) // Check it is odd or even (Means character position)
{
newname = (textname).ToUpperInvariant();
}
else
{
newname = (textname).ToLowerInvariant();
}
sb = sb.Append(newname); // Add one by on
}
string text = sb.ToString();
Response.Write(text); // Print in Page
}
{
string name = "Testpr";
string newname = "";
StringBuilder sb = new StringBuilder();
for (int i = 0; i < 6; i++)
{
string textname = name[i].ToString(); // Get Character one by one
if ((i % 2) == 0) // Check it is odd or even (Means character position)
{
newname = (textname).ToUpperInvariant();
}
else
{
newname = (textname).ToLowerInvariant();
}
sb = sb.Append(newname); // Add one by on
}
string text = sb.ToString();
Response.Write(text); // Print in Page
}
No comments:
Post a Comment