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

 

strpad

#include "sflstr.h"
char *
strpad (
    char *string,
    char ch,
    int  length)

Synopsis

Returns string of length characters, padding with ch or truncating if necessary. String must be at least length + 1 long.

Source Code - (sflstr.c)

{
    int cursize;

    ASSERT (string);
    cursize = strlen (string);          /*  Get current length of string     */
    while (cursize < length)            /*  Pad until at desired length      */
        string [cursize++] = ch;

    string [cursize++] = '\0';          /*  Add terminating null             */
    return (string);                    /*    and return to caller           */
}

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