Link to home
Start Free TrialLog in
Avatar of Lora
Lora

asked on

a function problem

Could You help me to write a function that would remove trailing blanks
and tabs from each line of input, and it would delete entirely blank lines.
Thank You!
Avatar of jhance
jhance

I could but not for 5 pts...  Maybe someone else needs them badly enough to bite.
Avatar of Lora

ASKER

I'm really sorry that's all I've got.
Are you referring to an input stream.






Avatar of Lora

ASKER

Yes.
Please help me with this problem.
If you want to use CStrings, you can use TrimLeft and TrimRight.

Basically, your code would look like this:

   CString myStr;
   
   // Set the value of myStr here
   
   
   myStr.TrimLeft();
   myStr.TrimRight();
   while(myStr.Replace("\r\n\r\n", "\r\n") > 0) ;
   while(myStr.Replace("\n\n", "\n") > 0) ;

I can write code using traditional DOS string functions if you like.
Avatar of Lora

ASKER

Can you please write it using traditional DOS string function
This will take a little while.  I'll try to have it posted as soon as possible.
ASKER CERTIFIED SOLUTION
Avatar of hongjun
hongjun
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hope you will give me more points and a better grade if you have the points.

Thanks
hongjun