Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.29 KB | None | 0 0
  1. STRING alltrim(STRING str2,STRING str1)
  2.     {
  3.     int nb;
  4.     int ne;  
  5.     int n;  
  6.     int lstr1=strlen(str1);
  7.     for (nb=0; nb<lstr1 && *(str1+nb) ==' '; nb++);
  8.     for (ne=lstr1; ne>= 0 && nb!=lstr1 && *(str1+ne-1) ==' ';ne--);
  9.     n=ne-nb;
  10.     strncpy(str2,str1+nb,n);
  11.     strcpy(str2+n,"\0");
  12.     return str2;
  13.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement