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

 

eatstr

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

Synopsis

Eats strToEat from strBuff only if it begins with contents of strToEat.

Examples

       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;

   ASSERT (strBuff);
   ASSERT (strToEat);

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

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

| << | < | > | >> iMatix Copyright © 1996-2000 iMatix Corporation