C Language Development Kit/Snippets/String/TrimRight

From OptiWiki

< C Language Development Kit | Snippets | String
Revision as of 08:13, 9 October 2009 by Jbo (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Description Removes the specific trailing characters from a string.
char *TrimRight( char *pszSource, char removeChar );
char *pszSource
The source input string where the trailing characters need be be remove from.
char removeChar
The specific key that is used to remove from the source input string.
Returns A pointer to the changed source input string.
Remarks The source input string is changed by this function.
#include "lib.h"
#include <stdio.h>
#include "input.h"     //Holds the input functions
#include "strfunc.h"   //Holds the string manipulation functions
void main( void )
    static char dummy[ 21 ];
        strcpy( dummy, "      123456      ");
        printf("\forg:|%s|,", dummy );
        printf("new:|%s|\n", TrimRight( dummy, ' ' ));
        printf("\npress a key");

Personal tools