Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- STRING alltrim(STRING str2,STRING str1)
- {
- int nb;
- int ne;
- int n;
- int lstr1=strlen(str1);
- for (nb=0; nb<lstr1 && *(str1+nb) ==' '; nb++);
- for (ne=lstr1; ne>= 0 && nb!=lstr1 && *(str1+ne-1) ==' ';ne--);
- n=ne-nb;
- strncpy(str2,str1+nb,n);
- strcpy(str2+n,"\0");
- return str2;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement