SkipSpaces.h


This function removes white spaces before and after a string value.

 ~wenchen/public_html/cgi-bin/351/week8/SkipSpaces.h 
#include  <cstring>
  using namespace  std;

void  SkipSpaces( char str[ ] ) {
  int  i = 0, len = strlen( str );

  while ( ( str[i] == ' ' ) || ( str[i] == '\n' ) ||
          ( str[i] == '\t' ) )   i++;
  strcpy( str, str+i );
  i = len - i - 1;
  while ( ( str[i] == ' ' ) || ( str[i] == '\n' ) ||
          ( str[i] == '\t' ) )   i--;
  str[i+1] = '\0';
}