home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Media Share 9
/
MEDIASHARE_09.ISO
/
cprog
/
actlib12.zip
/
STRINGS.ZIP
/
DELBLK.C
< prev
next >
Wrap
Text File
|
1993-01-14
|
944b
|
42 lines
/* Copyright (C) 1993 Marc Stern (internet: stern@mble.philips.be) */
#include "strings.h"
/*
* Function : strdelblk
*
* Description : Remove all spaces, tab and eol before and after a string.
*
* Decisions :
*
* Precond :
*
* Postcond :
*
*/
char *strdelblk( char *string )
{ char *ptr = string, *str_begin = string, *str_end = NULL;
/* skip blanks */
ptr += strspn( string, " \t\n" );
while ( 1 ) { switch( *string++ = *ptr++ )
{
case '\0': break;
case ' ' :
case '\t':
case '\n': str_end = NULL; continue;
default : if ( ! str_end ) str_end = string;
continue;
}
break;
}
if ( str_end ) *str_end = '\0';
return str_begin;
}