Created
February 17, 2019 16:58
-
-
Save aysegulsarikaya/1ea2befbfd0443737c6cfdc2574e7a3b to your computer and use it in GitHub Desktop.
Upper Surname
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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