Hi ok... I'm new in this and got my hands full! I got a string like ;
string strReg = "HGT554GP - Red Ford Courier";
I want to remove all characters after the first space. I only want "HGT554GP".
Please any help will be appreciated.
Melger
Loading

Sam HobbsRank #107 · 20.5K reputationPosted Nov 19, 2010, 4:51 PM EST
Suthish NairRank #92 · 22.8K reputationPosted Nov 19, 2010, 8:23 AM EST
Welcome to C# Corner.
Melger93 reputationPosted Nov 19, 2010, 8:33 AM EST
string strReg = "HGT554GP - Red Ford Courier";
I want to remove all characters before the last space. I only want "Red Ford Courier".
Thanks again.
Melger
Suthish NairRank #92 · 22.8K reputationPosted Nov 19, 2010, 9:09 AM EST
Melger93 reputationPosted Nov 19, 2010, 9:39 AM EST
Suthish NairRank #92 · 22.8K reputationPosted Nov 19, 2010, 9:53 AM EST
If this post helped you, then tick the checkbox above "Do you like this Answer"
Suthish NairRank #92 · 22.8K reputationPosted Nov 19, 2010, 6:28 PM EST
I got 3 different mails saying mine answer is accepted for this post.
But while viewing the thread its showing the accepted answer is not mine.
This might a bug happening here. Are the Administrators of site aware of this?
Sam HobbsRank #107 · 20.5K reputationPosted Nov 19, 2010, 6:39 PM EST
Melger93 reputationPosted Nov 19, 2010, 7:13 PM EST
Damit... first time I'm posting something and already broke it! Sorry guys, I think it was me selecting more than one checkbox! Suthish's code worked perfectly for me. Thanks again Suthish and sorry for breaking this thing!
Sam HobbsRank #107 · 20.5K reputationPosted Nov 19, 2010, 7:21 PM EST
Suthish NairRank #92 · 22.8K reputationPosted Nov 19, 2010, 8:09 PM EST
But i was wondering why i was getting Three accepted answer mails.. :-)
Answer disapproval notification mails also needed with reasons, will be an added advantage here.
Might this will get resolved in next release by C# Corner admins.
Melger,
Dont worry, keep posting your queries. Everyone here are ready to help you.
Good Day !
Mahesh ChandRank #1 · 393.3K reputationPosted Nov 20, 2010, 4:36 AM EST
You did not break anything.
Guys!
I am proposing to have multiple answers selected for a single question. The reason I say is, same problem can be solved in different ways.
But then issue may come, if another member replies the same. I guess we can live with it?
Alternatively, once an answer is accepted, we can CLOSE that thread. No more discussions about it.
What do you guys think? We will implement one of this right away and go live with it on Nov 27th.
Suthish NairRank #92 · 22.8K reputationPosted Nov 20, 2010, 7:04 AM EST
Sam HobbsRank #107 · 20.5K reputationPosted Nov 20, 2010, 11:46 AM EST
There are at least two reasons there could be multiple posts considered to be answers. Multiple ways to do things is one but also there are times when there are multiple pieces to an answer.
I am not sure about closing a thread to all replies when an answer has been accepted. I have seen times when someone suggests a way to do something but it is not a good way yet the person accepts it as an answer. Often once they accept a solution, they are not interested in doing it another way. The problem is that we want people to use previous answers when they are available instead of posting the same question multiple times. So if a thread is closed when an answer is accepted that is not the best answer, then other developers in the future will be mislead.