Skip to content

Instantly share code, notes, and snippets.

@aysegulsarikaya
Created February 17, 2019 16:58
Show Gist options
  • Select an option

  • Save aysegulsarikaya/1ea2befbfd0443737c6cfdc2574e7a3b to your computer and use it in GitHub Desktop.

Select an option

Save aysegulsarikaya/1ea2befbfd0443737c6cfdc2574e7a3b to your computer and use it in GitHub Desktop.
Upper Surname
private void btnEkle_Click(object sender, EventArgs e)
{
var Index = txtName.Text.LastIndexOf(" ");
var str = "";
var Flag = true;
for (int i = 0; i < txtName.Text.Length; i++)
{
if (Flag)
{
str += txtName.Text[i].ToString().ToUpper();
}
else str += txtName.Text[i].ToString();
Flag = (txtName.Text[i].ToString() == " ") || (i>Index);
}
lstNameList.Items.Add(str);
}
private void btnEkle2_Click(object sender, EventArgs e)
{
string[] tempName = txtName.Text.Split(' ');
var str = "";
for (int i = 0; i < tempName.Length-1; i++)
{
str +=$"{tempName[i].Replace(tempName[i].Substring(0, 1).ToString(), tempName[i].Substring(0, 1).ToUpper().ToString())} " ;
}
str += tempName[tempName.Length-1].ToUpper();
lstNameList.Items.Add(str);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment