//  Beta release only.
//
//  Copyright(c) Ivyware Pty Ltd 2006  (all rights reserved)
//               MELBOURNE, VICTORIA, AUSTRALIA, 3130
//
//  Provided no fee is charged (either by the distributer or user)
//  permission to use, copy, modify, and distribute this software and
//  its documentation for any purpose and without fee is hereby granted,
//  provided that the above copyright notice appear in all copies and
//  that both that copyright notice and this permission notice appear
//  in supporting documentation.
//
//  No waranty or suitablity for purpose is implied.
//
//
//  Implementation for CString extensions
//
#include "StdAfx.h"
#include "Sys/timeb.h"

#include "CString_Ext.h"

//
//  Truncates string at first occurence of passed characters
//
//  Parameters:  const CString& oCString
//               String to be truncated
//
//  Returns:     CString
//               Truncated string
CString
CString_Truncate ( const CString& oCString, LPCTSTR lpszCharset )
{
    // Introduce locals
    int idx = oCString.FindOneOf ( lpszCharset );
    if ( idx > 0 )
      return oCString.Left ( idx );
    return oCString;
}

//
//  Extracts string after first occurence of passed characters
//
//  Parameters:  const CString& oCString
//               String from which sub-string is to be extracted
//
//               int nMonth
//
//  Returns:     CString
//               Extracted string
CString
CString_Extract ( const CString& oCString, LPCTSTR lpszCharset )
{
    // Introduce locals
    int idx = oCString.FindOneOf ( lpszCharset );
    if ( idx < 0 )
      return oCString;
    int nLength = oCString.GetLength();
    if ( idx < nLength-1 )
      return oCString.Right ( nLength-idx-1 );
    return CString();
}
