Advertisement
axyd

C++ Remove Spaces and Dots

Oct 20th, 2016
386
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. void Xclass::zapper(int *alf, string& zap) { /*TRIMS INVALID CHARACTERS*/
  2.     string trim;
  3.     if (alf[0]==1) trim = "..  \n\t";   //for int
  4.     else if(alf[1]==1) trim = "  \n\t"; //for float
  5.     else {
  6.         switchBlade(444);
  7.         return;
  8.     }
  9. //  cout<<"\n\tzap: before "<<zap;
  10.     int i {};
  11.     while ((i = zap.find_first_of(trim)) != -1) zap.erase(i,1);
  12. //  cout<<"  after "<<zap<<endl;
  13. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement