| iMatix home page
| << | < | > | >>
SFL Logo SFL
Version 1.91

 

eatstr

#include "sflstr.h"
char *
eatstr (
    char **strBuff,
    char *strToEat)

Synopsis

Eats strToEat from strBuff only if it begins with contents of strToEat. char strBuff[] = { "select * from mytbl;" }; eatstr (&strBuff, "SELECT"); On return here strBuff would be: " * from mytbl;" If the token is not found, then strBuff will not be affected and a NULL char * will be returned, but any white spaces on the left of strBuff would be trimed. Submitted by Scott Beasley jscottb@infoave.com

Source Code - (sflstr.c)

{
   int iWasToken;

   ltrim (*strBuff);
   istoken (strBuff, strToEat, &iWasToken);

   return iWasToken ? *strBuff : (char *)NULL;
}

| << | < | > | >> iMatix Copyright © 1996-98 iMatix