Solved

C# question

Posted on 2011-03-25
4
261 Views
Last Modified: 2012-05-11
Friends,

I have string with Full Name like  (Mary Ann Smith) or (Andy De Souza).

I need to assign Smith or Souza as a last name and Mary Ann as a Firstname. My System does not have a middle name feature.

Would like to have a small snippet in c#
0
Comment
Question by:SubbuUSA
  • 2
4 Comments
 
LVL 18

Expert Comment

by:Dennis Aries
ID: 35215395
Where do you want to leave the part 'De' of 'Andy De Souza'? With the first name, or with the last?
0
 
LVL 7

Accepted Solution

by:
dimaj earned 250 total points
ID: 35215401
do something like this:

string name = "Mary Ann Smith";
int pos = name.LastIndexOf(' ');
string fName = name.Substring(0, pos);
string lName = name.Substring(pos + 1);
0
 

Author Comment

by:SubbuUSA
ID: 35215436
I want 'Andy De ' to be a first name
0
 

Author Closing Comment

by:SubbuUSA
ID: 35216532
Thanks
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now