Quantcast
Channel: separate first middle last name C# - Stack Overflow
Browsing latest articles
Browse All 6 View Live

Answer by Jean Carlos for separate first middle last name C#

public static string getMiddleName(string fullName) { var names = fullName.Split(''); string firstName = names[0]; string middleName = "";// names[1]; var index = 0; foreach (var item in names) { if...

View Article



Answer by Andrew Truckle for separate first middle last name C#

I know your question has been answered, and there are many ways you could look at handling this, but here is my suggestion with some explanations along the way:private void button1_Click(object sender,...

View Article

Answer by Fabio for separate first middle last name C#

As mentioned in another answer you need assign middle name only when third name exists.Below approach which uses Dictionary.TryGetValue method and C#7 feature for out parameters. var textInfo =...

View Article

Answer by user3956566 for separate first middle last name C#

You need to check for and handle the second name being empty. Initialising the string will prevent the crash, then checking for input.string secondName = ""; string secondFirstLetter = ""; string...

View Article

Answer by Vano Maisuradze for separate first middle last name C#

Here is the working example how you can do it:public class FullName{ public string FirstName { get; set; } public string MiddleName { get; set; } public string LastName { get; set; } public FullName()...

View Article


separate first middle last name C#

Goal: parse name when user enters name, and have a message box display with first middle and last name. Right now it only works when you type in three names, if you try two it crashes, and I'm sure...

View Article
Browsing latest articles
Browse All 6 View Live




Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>
<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596344.js" async> </script>