Beispiel #1
0
String CUtils::Trim(const String & data)
{
  String aux(data);
  
  if (aux.length() == 0) return aux;
  
  aux = LTrim(aux);
  aux = RTrim(aux);
  
  return aux;
}
Beispiel #2
0
BOOL CADORecordset::Open(_ConnectionPtr mpdb, LPCTSTR lpstrExec, int nOption)
{	
    Close();
 
    if(_tcscmp(lpstrExec, _T("")) != 0)
        m_strQuery = lpstrExec;

    ASSERT(!m_strQuery.empty());

    if(m_pConnection == NULL)
        m_pConnection = mpdb;

    LTrim(m_strQuery);

    BOOL bIsSelect = m_strQuery.substr(0,_tcslen(_T("select "))).compare(_T("select ")) == 0 && nOption == openUnknown;
    try {
        m_pRecordset->CursorType        = adOpenStatic;
        m_pRecordset->CursorLocation    = adUseClient;
        if(bIsSelect || nOption == openQuery || nOption == openUnknown) {
            m_pRecordset->Open(m_strQuery.c_str(),
                _variant_t((IDispatch*)mpdb,
                TRUE),
                adOpenStatic,
                adLockOptimistic,
                adCmdUnknown);

        } else if(nOption == openTable) {
            m_pRecordset->Open(m_strQuery.c_str(),
                _variant_t((IDispatch*)mpdb,
                TRUE),
                adOpenKeyset,
                adLockOptimistic,
                adCmdTable);

        } else if(nOption == openStoredProc) {
            m_pCmd->ActiveConnection        = mpdb;
            m_pCmd->CommandText             = _bstr_t(m_strQuery.c_str());
            m_pCmd->CommandType             = adCmdStoredProc;
            m_pConnection->CursorLocation   = adUseClient;
            m_pRecordset = m_pCmd->Execute(NULL, NULL, adCmdText);
        } else {
            TRACE( _T("Unknown parameter. %d"), nOption);
            return FALSE;
        }
    } catch(_com_error &e) {
        dump_com_error(e);
        return FALSE;
    }
    return m_pRecordset != NULL && m_pRecordset->GetState()!= adStateClosed;
}
void sendThroughUARTtoMSVS(void) {

     IntToStr(AccX, data_);
     UART1_Write_Text(data_);
     UART1_Write(' ');
     IntToStr(AccY, data_);
     UART1_Write_Text(data_);
     UART1_Write(' ');
     IntToStr(AccZ, data_);
     UART1_Write_Text(data_);
     UART1_Write(' ');
     IntToStr(GyrX, data_);
     UART1_Write_Text(data_);
     UART1_Write(' ');
     IntToStr(GyrY, data_);
     UART1_Write_Text(data_);
     UART1_Write(' ');
     IntToStr(GyrZ, data_);
     UART1_Write_Text(data_);
     UART1_Write(' ');
     IntToStr(Tmp, data_);
     UART1_Write_Text(data_);
     UART1_Write(' ');
     
     IntToStr(UT, data_);
     UART1_Write_Text(data_);
     UART1_Write(' ');
     LongWordToStr(UP, data_);
     LTrim(data_);
     UART1_Write_Text(data_);

     IntToStr(Xmag, data_);
     UART1_Write_Text(data_);
     UART1_Write(' ');
     IntToStr(Ymag, data_);
     UART1_Write_Text(data_);
     UART1_Write(' ');
     IntToStr(Zmag, data_);
     UART1_Write_Text(data_);
     UART1_Write(' ');
     
//     UART1_Write(13);//CR
     UART1_Write(31);//US

     return;
}
Beispiel #4
0
void test_util()
{
	char tmp[100];
	strcpy(tmp,"strIng");
	printf("test string Lower to Upper\n");
	printf("before:%s\n",tmp);
	StrToUpper(tmp);
	printf("after:%s\n",tmp);
	
	memset(tmp,0x00,sizeof tmp);
	strcpy(tmp,"STRiNG");
	printf("test string Lower to Upper\n");
	printf("before:%s\n",tmp);
	StrToLower(tmp);
	printf("after:%s\n",tmp);

	memset(tmp,0x00,sizeof tmp);
	strcpy(tmp,"STRiNG      ");
	printf("test string remove right space\n");
	printf("before:%s\n",tmp);
	RTrim(tmp);
	printf("after:%s\n",tmp);

	memset(tmp,0x00,sizeof tmp);
	strcpy(tmp,"        STRiNG");
	printf("test string remove left space\n");
	printf("before:%s\n",tmp);
	LTrim(tmp);
	printf("after:%s\n",tmp);

	memset(tmp,0x00,sizeof tmp);
	strcpy(tmp,"        STRiNG            ");
	printf("test string remove left and right space\n");
	printf("before:%s\n",tmp);
	Trim(tmp);
	printf("after:%s\n",tmp);
}
Beispiel #5
0
void XMLElement :: DumpOn( std::ostream & os, bool recurse  ) const {
	os << "<" << Name();
	for ( unsigned int i = 0; i < AttrCount(); i++ ) {
		os << " " << AttrName(i) << "=\"";
		os << AttrValue( AttrName(i) ) << "\"";
	}
	if ( ! recurse ) {
		os << "/>\n";
	}
	else {
		os << ">\n";
		for ( unsigned int i = 0; i < ChildCount(); i++ ) {
			const XMLElement * ce = ChildElement( i ) ;
			if ( ce ) {
				ce->DumpOn( os, recurse );
			}
			const XMLText * ct = ChildText( i );
			if ( ct ) {
				os << LTrim( ct->Text() ) << "\n";
			}
		}
		os << "</" << Name() << ">\n";
	}
}
Beispiel #6
0
static std::string Trim(std::string instr)
{
	return LTrim(RTrim(instr));
}
Beispiel #7
0
void Trim(string& strStr)
{
	LTrim(strStr);
	RTrim(strStr);
}
Beispiel #8
0
void AxString::Trim()
{
   RTrim();
   LTrim();
}
Beispiel #9
0
inline std::string& Trim(std::string &s) {
  return LTrim(RTrim(s));
}
Beispiel #10
0
void Trim( txstring& wsInOut )
{
	RTrim(wsInOut);
	LTrim(wsInOut); 
}
Beispiel #11
0
 free(ptr);       

 ptr=Substr("LIGNE DE TEXTE","7","0","\0");
 printf("Cas longueur=0 :%s:\n",ptr);
 free(ptr);       


 ptr=Substr("LIGNE DE TEXTE","3","18","\0");
 printf("Cas trop long :%s:\n",ptr);
 free(ptr);       

 ptr=Substr("LIGNE DE TEXTE","35","4","\0");
 printf("Cas debut>len(chaine) :%s:\n",ptr);
 free(ptr);       

 ptr=LTrim("ESSAI  I ","\0");
 printf("Ltrim:%s:\n",ptr);
 free(ptr);

 ptr=LTrim("  ESSAI  I ","\0");
 printf(":%s:\n",ptr);
 free(ptr);

 ptr=LTrim(" ","\0");
 printf(":%s:\n",ptr);
 free(ptr);
 
 ptr=LTrim("","\0");
 printf(":%s:\n",ptr);
 free(ptr);
Beispiel #12
0
std::string Trim(const std::string &source){
    return LTrim(RTrim(source));
}
Beispiel #13
0
inline std::string& TrimQuotes(std::string& s) {
  TrimPred qpred = [](char c) { return c != '\'' && c != '\"'; };
  return LTrim(RTrim(s, qpred), qpred);
}
Beispiel #14
0
inline std::string& TrimWhitespace(std::string& s) {
  TrimPred wspred = std::not1(std::ptr_fun<int, int>(std::isspace));
  return LTrim(RTrim(s, wspred), wspred);
}
Beispiel #15
0
inline std::string& Trim(std::string& s, const TrimPred& pred) {
  return LTrim(RTrim(s, pred), pred);
}
Beispiel #16
0
	std::string& Util::Trim(std::string &str)
	{
		return LTrim(RTrim(str));
	}
Beispiel #17
0
VOID ACLStr::Trim(VOID)
{
	RTrim();
	LTrim();
} // Trim
Beispiel #18
0
std::string stringUtil::Trim(const std::string& str,const std::string& spaces)
{
	return LTrim(RTrim(str,spaces),spaces);
}
Beispiel #19
0
CString CString::TrimStart()
{
	return LTrim();
}
Beispiel #20
0
csStringBase &csStringBase::Trim()
{
  return LTrim().RTrim();
}
Beispiel #21
0
moText0& moText0::Trim()
{
    LTrim();
    RTrim();
    return *this;
}
char *Trim (char *Str)
{
    return RTrim (LTrim (Str));
}
Beispiel #23
0
std::string& Trim(std::string &s)
{
	return RTrim(LTrim(s));
}
Beispiel #24
0
inline std::string& Trim(std::string &s, char x) {
  return LTrim(RTrim(s, x), x);
}