C/C++ Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingC/C++ Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old December 6th, 2012, 02:55 AM
chochocho chochocho is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 2 chochocho User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 32 m 45 sec
Reputation Power: 0
Unhappy I am having trouble removing the leading spaces

what i have to do is remove the white spaces and change it to last first. (ex. ^^^^Charlie^^^Brown turns in to Brown, Charlie.)^ is a space

The problem i am having is that some of the last names are not being displayed.

What is going in
^^^^^^^Eric^^^^Kim^^
^^David^^^^^^Beazley^^^^
^^^Brad Howes^
^Scott^^^^^Stanton
Tim Kientzle^^
^^^^^^Ray^^Lischner^^^^^^^
Douglas Troy

Whats coming out

Kim, Eric.
Beazley, David.
Howes, Brad.
, Scott. // No last name
Kientzle, Tim.
Lischner, Ray.
, Douglas. //no last name

ItemType parseInputItemType(ItemType line)
{
ItemType first, last, temp;
bool next= false;


for(int x = 0; x < line.length() -1; x++)
{

if(!isspace(line.at(x)))
{
temp = temp + line.at(x);
if(line.at(x+1) == ' ' and next == false )
{
first = temp;
temp = "";
next =true;
}
if(line.at(x+1) == ' ' and next == true )
{
last = temp;
temp = "";
}
}
}
return (last +", " +first +'.');
}

Reply With Quote
  #2  
Old December 6th, 2012, 11:44 PM
Jones21 Jones21 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 8 Jones21 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 14 m 42 sec
Reputation Power: 0
nice to meet you




Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingC/C++ Help > I am having trouble removing the leading spaces


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.

© 2003-2014 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap