StrTrimStrTrim*
*



Contents  *



Index  *Topic Contents
*Previous Topic: StrToIntEx
*Next Topic: Path Functions

StrTrim


BOOL StrTrim(
    LPTSTR psz,
    LPCTSTR pszTrimChars
    );

Removes (trims) any leading and trailing characters from a string.

psz
Address of a string buffer that contains the string to be trimmed.
pszTrimChars
Address of an array of characters that will be trimmed from psz. The last element in this array must be zero.

Example:

#include <windows.h>
#include <iostream.h>
#include "Shlwapi.h"

void main( void )
{
  //String one
  TCHAR buffer[] = TEXT("_!ABCDEFG#");
  TCHAR trim[] = TEXT("#A!_\0");

  cout  <<  "The string before calling StrTrim: ";
  cout  <<  buffer;
  cout  <<  "\n";

  StrTrim(buffer, trim);

  cout  <<  "The string after calling StrTrim: ";
  cout  <<  buffer;
  cout  <<  "\n";

}

OUTPUT:
- - - - - -
The string before calling StrTrim: _!ABCDEFG#
The string after calling StrTrim: BCDEFG

Up Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.