当前位置: 首页>>代码示例>>C++>>正文


C++ AnsiString::AnsiPos方法代码示例

本文整理汇总了C++中AnsiString::AnsiPos方法的典型用法代码示例。如果您正苦于以下问题:C++ AnsiString::AnsiPos方法的具体用法?C++ AnsiString::AnsiPos怎么用?C++ AnsiString::AnsiPos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AnsiString的用法示例。


在下文中一共展示了AnsiString::AnsiPos方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: if

void __fastcall TForm1::OpenPicture1Click(TObject *Sender)
{
    OpenPictureDialog1->Filter =
       "Bmp files (*.bmp)|*.BMP| JPEG images (*.jpg) | *.jpg; " ;
    if (OpenPictureDialog1->Execute())
    {
        if (!FileExists(OpenPictureDialog1->FileName))
            return;
        AnsiString temp2 = ExtractFileName(OpenPictureDialog1->FileName);
        AnsiString temp = ExtractFileExt(OpenPictureDialog1->FileName);
        AnsiString Ext = temp.LowerCase();

        if (Ext.AnsiPos("jpg") > 0)
        {
            TJPEGImage *myjpeg = new TJPEGImage();
            myjpeg->LoadFromFile(OpenPictureDialog1->FileName);
            myjpeg->DIBNeeded();
            Image1->Picture->Bitmap->Assign(myjpeg);
            delete myjpeg;
        }
        else if (Ext.AnsiPos("bmp") > 0)
        {
            Image1->Picture->Bitmap->LoadFromFile(OpenPictureDialog1->FileName);
        }
    }
        {
        Undo1->Enabled=false; //apenergopoioume ta undo/redo
        Redo1->Enabled=false;
        ToolUndo->Enabled=false;
        ToolRedo->Enabled=false;
        }
}
开发者ID:dd731,项目名称:Paint-Project-in-C-plusplus,代码行数:32,代码来源:Unit1.cpp

示例2: if

//---------------------------------------------------------------------------
TStringList* StringToTok2( AnsiString Words,
  AnsiString Dlmtr1, AnsiString Dlmtr2 )
{
  AnsiString Work = Words.Trim();
  int spos;
  TStringList *Making = new TStringList;

  int spos1 = Work.AnsiPos(Dlmtr1);
  int spos2 = Work.AnsiPos(Dlmtr2);
  while (spos1 || spos2) {
 //   int spos = 0;
    if (!spos1 && spos2) spos = spos2;
    else if (!spos2 && spos1) spos = spos1;
    else spos = (spos1 < spos2) ? spos1 : spos2;
    Making->Add(Work.SubString( 1, spos-1));
    Work = Work.SubString( spos+1, Work.Length() - spos);
    Work = Work.Trim();
    spos1 = Work.AnsiPos(Dlmtr1);
    spos2 = Work.AnsiPos(Dlmtr2);
  } // while
  if (Work != "")
    Making->Add(Work);

  return Making;
}
开发者ID:GraffLittle,项目名称:first,代码行数:26,代码来源:Commons.cpp

示例3:

//---------------------------------------------------------------------------
double __fastcall CNHB300::GetWeight()
{
        char strReceive[300]={0};
        AnsiString strMsg;
        AnsiString strMsgNew;

        if(ReadSizeData(strReceive))
        {
               AnsiString strMsg=strReceive;

               int nPosStart=strMsg.AnsiPos("ST,");
               int nPosEnd=strMsg.SubString(nPosStart,15).AnsiPos("g")+nPosStart-1;


                if(nPosStart>0 && nPosEnd>0 && (nPosEnd-nPosStart)>5)
                {
                                strMsgNew=strMsg.SubString(nPosEnd-8,8);
                                if(strMsgNew.AnsiPos("-")>0)
                                {
                                        strMsgNew=strMsg.SubString(nPosEnd-7,7);
                                        return strMsgNew.ToDouble()*-1.0;
                                }
                                else return strMsgNew.ToDouble();
                }
                else return -999.0;
        }
        else return -999.0;

}
开发者ID:Raxtion,项目名称:CT83,代码行数:30,代码来源:NHB300.cpp

示例4: images

//simvan gia tin apothikeusi tis eikonas otan patiete to save
//dinatotita gia apothikeusi se bmp & jpg morfi
void __fastcall TForm1::SavePic1Click(TObject *Sender)
{
  SavePictureDialog1->Title = "Save Image";
  SavePictureDialog1->DefaultExt = "jpg";
  SavePictureDialog1->Filter =
       "JPEG images (*.jpg) | *.jpg; | Bmp files (*.bmp)|*.BMP" ;
  SavePictureDialog1->FilterIndex = 1;
    if (SavePictureDialog1->Execute())
    {
        AnsiString temp2 = ExtractFileName(SavePictureDialog1->FileName);
        AnsiString temp = ExtractFileExt(SavePictureDialog1->FileName);
        AnsiString Ext = temp.LowerCase();

        if (Ext.AnsiPos("jpg") > 0)
        {
            TJPEGImage *jp = new TJPEGImage();
            try
            {
              jp->Assign(Image1->Picture->Bitmap);
              jp->SaveToFile(SavePictureDialog1->FileName);
            }
            __finally
            {
              delete jp;
            }
        }
开发者ID:dd731,项目名称:Paint-Project-in-C-plusplus,代码行数:28,代码来源:Unit1.cpp

示例5: lvMessagePartsClick

void __fastcall TMainFrm::lvMessagePartsClick(TObject *Sender)
{
AnsiString LaunchFileName;
  //{display message parts we selected}
   if (lvMessageParts->Selected!=NULL)
      {
              LaunchFileName=lvMessageParts->Selected->Caption;
              LaunchFileName=UpperCase(LaunchFileName);
              if (LaunchFileName.AnsiPos(".EXE")>0)
                {
                WinExec(LaunchFileName.c_str(),SW_NORMAL);
                }
              else
              { char * associatedfilename=new char[MAX_PATH];//buffer for filename of associated executable

                HINSTANCE hinstassociation=FindExecutable(LaunchFileName.c_str(),ExcludeTrailingBackslash(ExtractFilePath(LaunchFileName)).c_str(), associatedfilename);

                if (hinstassociation>(HINSTANCE)32)//successful association found
                 {
                 AnsiString combinedfilenames=associatedfilename;
                 combinedfilenames = combinedfilenames + " \"" + LaunchFileName + "\"";
                 WinExec(combinedfilenames.c_str(),SW_NORMAL);
                 }
                 delete []associatedfilename;//free the memory
               }

      }
}
开发者ID:java-tester-x,项目名称:SendFileHttp,代码行数:28,代码来源:MainForm.cpp

示例6: TRegistry

//---------------------------------------------------------------------------
AnsiString __fastcall GetMatlab6Root(void)
{
   AnsiString S = "";
   __TRY
   TRegistry *RR = new TRegistry();
   try
    {
    // Для Matlab 6.5

     RR->RootKey = HKEY_CLASSES_ROOT;
     if (RR->OpenKey("\\Matlab.Application.Single.6\\CLSID",false))
       S = RR->ReadString("");
     if (RR->OpenKey("\\CLSID\\"+S+"\\LocalServer32",false))
       S = RR->ReadString("");
     int ps = S.AnsiPos("matlab.exe");
     if (ps) {
      S = S.SubString( 1, ps-2);
     // S содержит размещение matlab.exe (полный путь)
      S = ExtractFileDir(S);
      S = ExtractFileDir(S);
      }
    }
      __finally {
      delete RR;
      }
  if (!DirectoryExists(S)) {
    S = "";
    }
  __CATCH
  return S;
}
开发者ID:GraffLittle,项目名称:first,代码行数:32,代码来源:Commons.cpp

示例7: GetTCPClientConfigFromStr

void GetTCPClientConfigFromStr(const AnsiString& configure,
                               AnsiString& ip,
                               int& port)
{
    int splitpos = configure.AnsiPos(",");
    if (splitpos > 0) {
        ip = configure.SubString(1, splitpos - 1);
        port = StrToInt(configure.SubString(splitpos+1, configure.Length()));
    }
}
开发者ID:vvvvcp,项目名称:PrivateDataRouter,代码行数:10,代码来源:UComm.cpp

示例8: wxFileConfig

//----------------------------------------------------------------------------
//class TMemIniFile : public TCustomIniFile
//----------------------------------------------------------------------------
// TIniFileのバグ回避版らしい・・・が、TIniFileと同じことをやる。ドン
TMemIniFile::TMemIniFile(const AnsiString& str) : m_pStream(NULL), m_pConfig(NULL)
{
	if ( str.AnsiPos("\\\\?\\") )
		m_strIniFile = str.SubString( 4, str.Length() - 4).c_str();
	else
		m_strIniFile = str.c_str();
//	m_pStream = new wxFileInputStream( m_strIniFile );
//	m_pConfig = new wxFileConfig(*m_pStream);

//	m_pConfig = new wxFileConfig(wxEmptyString, wxEmptyString, m_strIniFile, wxEmptyString, wxCONFIG_USE_LOCAL_FILE);
	m_pConfig = new wxFileConfig(wxT("krkr"), wxT("ym"), m_strIniFile, wxEmptyString, wxCONFIG_USE_LOCAL_FILE);
}
开发者ID:xmoeproject,项目名称:X-moe,代码行数:16,代码来源:IniFiles.cpp

示例9: StringToTokiensA

//---------------------------------------------------------------------------
void StringToTokiensA( AnsiString Words, AnsiString Dlmtr, TStrings *Making )
{
  AnsiString Work = Words.Trim();
  int spos;
  while ((spos = Work.AnsiPos(Dlmtr)) != 0) {
    Making->Add(Work.SubString( 1, spos-1));
    Work = Work.SubString( spos+1, Work.Length() - spos);
    Work = Work.Trim();
  } // while
  if (Work != "")
    Making->Add(Work);
}
开发者ID:GraffLittle,项目名称:first,代码行数:13,代码来源:Commons.cpp

示例10: RexecSocketRead

void __fastcall TCreateProjectDatabase::RexecSocketRead(TObject *Sender,
      TCustomWinSocket *Socket)
{
	String	answer = rob->OnRead_handler( Socket );		// READ INCOMING DATA

    // add one line at at time to memo
    // instead of entire answer
    // ACC, 11/04/03

    AnsiString buffer = answer;
    AnsiString line;
    int poscr = buffer.AnsiPos( "\n" );
    while ( poscr != 0 )
    {
        line = buffer.SubString( 1, poscr-1 );
	    ReplyMemo->Lines->Add( line );
        buffer = buffer.SubString( poscr + 1, buffer.Length() );
        poscr = buffer.AnsiPos( "\n" );
    }
    if ( buffer != NULL )
    {
        ReplyMemo->Lines->Add( buffer );
    }
}
开发者ID:drkvogel,项目名称:retrasst,代码行数:24,代码来源:CreateProjectDatabase1.cpp

示例11: TVPPushFilterPair

//---------------------------------------------------------------------------
static void TVPPushFilterPair(std::vector<AnsiString> &filters, AnsiString filter)
{
	int vpos = filter.AnsiPos("|");
	if(vpos)
	{
		AnsiString name = filter.SubString(1, vpos - 1);
		AnsiString wild = filter.c_str() + vpos;
		filters.push_back(name);
		filters.push_back(wild);
	}
	else
	{
		filters.push_back(filter);
		filters.push_back(filter);
	}
}
开发者ID:xmoeproject,项目名称:X-moe,代码行数:17,代码来源:FileSelector.cpp

示例12: StringToTokiens

//---------------------------------------------------------------------------
TStringList* StringToTokiens( AnsiString Words, AnsiString Dlmtr )
{
  AnsiString Work = Words.Trim();
  int spos;
  TStringList *Making = new TStringList;

  while ((spos = Work.AnsiPos(Dlmtr)) != 0) {
    Making->Add(Work.SubString( 1, spos-1));
    Work = Work.SubString( spos+1, Work.Length() - spos);
    Work = Work.Trim();
  } // while
  if (Work != "")
    Making->Add(Work);

  return Making;
}
开发者ID:GraffLittle,项目名称:first,代码行数:17,代码来源:Commons.cpp

示例13: GetPos

inline int GetPos(const AnsiString& s, const AnsiString& p)
{
    return s.AnsiPos(p);
}
开发者ID:stievie,项目名称:Martis,代码行数:4,代码来源:cdiroutl.cpp


注:本文中的AnsiString::AnsiPos方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。