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

 

strunique

#include "sflstr.h"
char *
strunique (
    char *string,
    char  unique)

Synopsis

Reduces chains of some character to a single instances. For example: replace multiple spaces by one space. Returns string.

Source Code - (sflstr.c)

{
    char
        *from,
        *to;

    ASSERT (string);
    if (strnull (string))
        return (string);                /*  Get rid of special cases         */

    from = string + 1;
    to   = string;
    while (*from)
      {
        if (*from == unique && *to == unique)
            from++;
        else
            *++to = *from++;
      }
    *++to = '\0';
    return (string);
}

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