Solved

C# question

Posted on 2011-03-25
4
276 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
New to SOAP and need some direction 10 79
C#.NET and microsoft certification. 3 40
EF5: Question about Metadata Artifact Processing 4 15
Printing 1 51
Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

776 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