• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ Mid函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中Mid函数的典型用法代码示例。如果您正苦于以下问题:C++ Mid函数的具体用法?C++ Mid怎么用?C++ Mid使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: Teilen

BOOL CxString :: Teilen( CString& h, CString& r, char c, BOOL trimmen )
{	int			i = Find( c );
	CxString	head = h;
	CxString	rest = r;
	BOOL		result = FALSE;

	if( i > 0 ) {
		head = Left( i );
		rest = Mid( i + 1 );
		result = TRUE;
	}
	else if( i == 0 ) { // c ist erstes Zeichen
		head.Empty();
		rest = Mid( 1 );
	}
	else { // Zeichen nicht gefunden!
		head = *this;
		rest.Empty();
	}

	if ( trimmen )
	{	head.TrimAll();
		rest.TrimAll();
	}

	h = head;
	r = rest;
	return result;
}	// Teilen
开发者ID:hkaiser,项目名称:TRiAS,代码行数:29,代码来源:CXSTRING.CPP


示例2: while

BOOL ELString::GetFirstArg (ELString& arg)
{
	int	 c;
	BOOL quote = FALSE;
	BOOL esc   = FALSE;
	BOOL start = FALSE;
	int  pos   = 0;
	int  first = -1;
	int  last  = -1;
	LPCTSTR	line;

	line = *this;

	while ((c = *line) != '\0') {
		if (quote && !start) {
			start = TRUE;
			first = pos;
		}
		if (!start && isspace(c)) {
		} else if ((!quote && (isspace (c) || c == ';')) || (quote && !esc && c == '"')) {
			last = pos;
			break;
		} else if (start && quote && !esc && c == '\\') {
			esc = TRUE;
		} else if (!quote && c == '"') {
			quote = TRUE;
		} else {
			if (!start) {
				first = pos;
				start = TRUE;
			}
			esc = FALSE;
		}
		line++;
		pos++;
	}
	if (last < 0)
	{
		last = pos;
	}

	if (start)
	{
		arg = Mid(first, last - first);
		ELString temp;

		if (pos < GetLength())
		{
			pos++;
		}
		temp  = Mid(pos);
		*this = temp;

	}

	return start;
}
开发者ID:greggman,项目名称:elibs,代码行数:57,代码来源:strings2.cpp


示例3: LastIndexOf

FarFileName FarFileName::GetExt() const
{
  int p = LastIndexOf ('.');
  if (p == -1)
    return FarFileName (".");
  return FarFileName (Mid (p));
}
开发者ID:Maximus5,项目名称:evil-programmers,代码行数:7,代码来源:FARString.cpp


示例4: RenderCharPath

void RenderCharPath(const char* gbuf, unsigned total_size, FontGlyphConsumer& sw, double xx, double yy)
{
	const char* cur_glyph = gbuf;
	const char* end_glyph = gbuf + total_size;
	Pointf pp(xx, yy);
	while(cur_glyph < end_glyph) {
		const TTPOLYGONHEADER* th = (TTPOLYGONHEADER*)cur_glyph;
		const char* end_poly = cur_glyph + th->cb;
		const char* cur_poly = cur_glyph + sizeof(TTPOLYGONHEADER);
		sw.Move(fx_to_dbl(pp, th->pfxStart));
		while(cur_poly < end_poly) {
			const TTPOLYCURVE* pc = (const TTPOLYCURVE*)cur_poly;
			if (pc->wType == TT_PRIM_LINE)
				for(int i = 0; i < pc->cpfx; i++)
					sw.Line(fx_to_dbl(pp, pc->apfx[i]));
			if (pc->wType == TT_PRIM_QSPLINE)
				for(int u = 0; u < pc->cpfx - 1; u++) {
					Pointf b = fx_to_dbl(pp, pc->apfx[u]);
					Pointf c = fx_to_dbl(pp, pc->apfx[u + 1]);
					if (u < pc->cpfx - 2)
						c = Mid(b, c);
					sw.Quadratic(b, c);
				}
			cur_poly += sizeof(WORD) * 2 + sizeof(POINTFX) * pc->cpfx;
		}
		sw.Close();
		cur_glyph += th->cb;
    }
}
开发者ID:koz4k,项目名称:soccer,代码行数:29,代码来源:FontWin32.cpp


示例5: GetLength

void COXString::LTrim()
{    
	int nStringIndex = 0;
	int nLength = GetLength();

	// find first non-space character
	LPCTSTR lpsz = *this;
	while (_istspace(*lpsz))
#ifdef WIN32
		lpsz = _tcsinc(lpsz);
#else
		lpsz++;
#endif

	// fix up data and length
#if _MFC_VER < 0x0700
	nStringIndex = lpsz - m_pchData;
#else
	nStringIndex = PtrToInt(lpsz - GetBuffer());
#endif
	if (nStringIndex == nLength)
		*this = COXString(_T(""));
	else	
		*this = Mid(nStringIndex);	
}
开发者ID:Spritutu,项目名称:AiPI-1,代码行数:25,代码来源:XSTRING.CPP


示例6: make_pair

std::pair< std::map<wxString, wxString>,
           std::vector<wxString> >
scanning_for_playlists_dlg::parse_properties(wxString const &line,
                                             wxString const &wanted_content)
  const {
  std::map<wxString, wxString> properties;
  std::vector<wxString> files;
  wxString info;
  int pos_wanted, pos_properties;

  if (wxNOT_FOUND == (pos_wanted = line.Find(wanted_content)))
    return std::make_pair(properties, files);

  auto rest = line.Mid(pos_wanted + wanted_content.Length());
  if (wxNOT_FOUND != (pos_properties = rest.Find(wxT("["))))
    info = rest.Mid(pos_properties + 1).BeforeLast(wxT(']'));

  if (info.IsEmpty())
    return std::make_pair(properties, files);

  for (auto &arg : split(info, wxU(" "))) {
    auto pair = split(arg, wxU(":"), 2);
    if (pair[0] == wxT("playlist_file"))
      files.push_back(pair[1]);
    else
      properties[pair[0]] = unescape(pair[1]);
  }

  return std::make_pair(properties, files);
}
开发者ID:RaceOfAce,项目名称:mkvtoolnix,代码行数:30,代码来源:scanning_for_playlists_dlg.cpp


示例7: Mid

void Bitmap::roundRectFill(int radius, int x1, int y1, int x2, int y2, Graphics::Color color) const {
    const int width = x2 - x1;
    const int height = y2 - y1;
    radius = Mid(0, radius, Min((x1+width - x1)/2, (y1+height - y1)/2));

    double quarterTurn = Util::pi / 2;
    double quadrant1 = 0;
    /* signs are flipped because the coordinate system is reflected over the y-axis */
    double quadrant2 = -Util::pi / 2;
    double quadrant3 = Util::pi;
    double quadrant4 = -3 * Util::pi / 2; 

    /* upper right. draw from 90 to 0 */
    arcFilled(x2 - radius, y1 + radius, quadrant1, quadrant1 + quarterTurn, radius, color);
    /* upper left. draw from 180 to 90 */
    arcFilled(x1 + radius, y1 + radius, quadrant2, quadrant2 + quarterTurn, radius, color);
    /* lower left. draw from 270 to 180 */
    arcFilled(x1 + radius, y2 - radius, quadrant3, quadrant3 + quarterTurn, radius, color);
    /* lower right. draw from 360 to 270 */
    arcFilled(x2 - radius, y2 - radius, quadrant4, quadrant4 + quarterTurn, radius, color);

    rectangleFill(x1+radius + 1, y1, x2-radius - 1, y1+radius - 1, color);
    rectangleFill(x1, y1+radius, x2, y2-radius, color);
    rectangleFill(x1+radius + 1, y2-radius + 1, x2-radius - 1, y2, color);
}
开发者ID:marstau,项目名称:shinsango,代码行数:25,代码来源:bitmap.cpp


示例8: Mid

bool MString::StringAt(int start, int length, ... )
{

        if (start < 0) return FALSE;

        char    buffer[64];
        char*   test;
        CString target;

        test = buffer;
        target = Mid(start, length);

        va_list sstrings;
        va_start(sstrings, length);
        
        do
        {
                test = va_arg(sstrings, char*);
                if(*test AND (target == test))
                        return true;

        }while(strcmp(test, ""));

        va_end(sstrings);

        return false;
}
开发者ID:KamalKaur,项目名称:metaphone,代码行数:27,代码来源:dmetaph-atkinson.cpp


示例9: Mid

KString KString::TrimLeft() const
{
	size_t i;
	for(i = 0 ; _istspace(m_Chars[i]) ; i++);

	return Mid(i);
}
开发者ID:tetratec,项目名称:runescape-classic-dump,代码行数:7,代码来源:kstring.cpp


示例10: Trim

StrPP& StrPP::Justify(char type, int len, char mode)
{
  if(mode&TRIM)
    Trim();				// delete outter whitespace

  if(strLen >= len && !(mode&CLIP))	// check for out-of-bounds
    return *this;

  if(strLen > len && (mode&CLIP))	// check for clipping
  {
    if(type == LEFT)
      Left(len);
    else if(type == CENTER)
      Mid((strLen-len)/2, len);
    else if(type == RIGHT)
      Right(len);

    return *this;			// return clipped string
  }

  if(type == LEFT)
    *this = *this + StrPP(' ', len-strLen);
  else if(type == CENTER)
    *this = StrPP(' ', (len-strLen)/2) + *this +
	    StrPP(' ', len - (len+strLen)/2);
  else if(type == RIGHT)
    *this = StrPP(' ', len-strLen) + *this;

  strLen = strlen(strPtr);
  return *this; 			// return normal string
}
开发者ID:ChenYingChou,项目名称:clib,代码行数:31,代码来源:str.cpp


示例11: ReverseFind

CString CMyString::GetExt() const
{
    if (IsEmpty()) return _T("");
    int index = ReverseFind('.');
    if (index < 0) return _T("");
    else           return Mid(index);
}
开发者ID:vinnie38170,项目名称:klImageCore,代码行数:7,代码来源:MyString.cpp


示例12: Find

int CUIString::Replace(LPCWSTR pstrFrom, LPCWSTR pstrTo)
{
    CUIString sTemp;
    int nCount = 0;
    
    //
    // search the string we want to replace
    //
    
    int nPos = Find(pstrFrom);
    if(nPos < 0)
        return 0;
    
    //
    // here the string exist
    //
    
    int cchFrom = (int)wcslen(pstrFrom);
    int cchTo = (int)wcslen(pstrTo);
    while(nPos >= 0) {
        
        //
        // save the left string at position we searched
        //
        
        sTemp = Left(nPos);
        
        //
        // append the replaced string.
        //
        
        sTemp += pstrTo;
        
        //
        // append the last string
        //
        
        sTemp += Mid(nPos + cchFrom);
        
        //
        // assign buffer to this class
        //
        
        Assign(sTemp);
        
        //
        // Find again until not found
        //
        
        nPos = Find(pstrFrom, nPos + cchTo);
        nCount++;
    }
    
    //
    // return how many places we replaced
    //
    
    return nCount;
}
开发者ID:asdlei00,项目名称:gtkduilib,代码行数:59,代码来源:UIString.cpp


示例13: GetTail

void CParseString::GetTail(CString& word)
{
    word.Empty();

    int i;
    for (i = m_CurIndex; i < GetLength() && IsSeparator(i); i++);
    if (i < GetLength()) word = Mid(i);
}
开发者ID:vinnie38170,项目名称:klImageCore,代码行数:8,代码来源:MyString.cpp


示例14: Left

bool CFilename::GetDriver(CString &driver, CString &path)
{
int	pos;

	if ((pos = Find(':')) != -1) {
		driver = Left(pos);
		driver.MakeUpper();
		path = Mid(pos + 1);

		return true;
	} else {
		driver.Empty();
		path = Mid(0);

		return false;
	}
}
开发者ID:CUBRID,项目名称:cubrid,代码行数:17,代码来源:FILENAME.CPP


示例15: test

void test()
{
	Assign();
	Add1();
	Add2();
	GetBuffer();
	Compare();
	Mid();
}
开发者ID:kippler,项目名称:Samples,代码行数:9,代码来源:main.cpp


示例16: fprintf

//----------------------------------------------------------------------
void GeneralMatrix::display(FILE* fpout)
{
  if (fpout == NULL) return;
  fprintf(fpout,"{\n");
  if (nBlock>0 && blockStruct) 
  {
    for (int l=0; l<nBlock; ++l) 
    {
      fprintf(fpout, "{");
      if (!isSparse)
      {
        int nRow = RowDimension(mat[l]);
        int nCol = ColDimension(mat[l]);	
        for(int i=0; i<nRow-1; i++)
        {
          if(i==0) fprintf(fpout," ");
            else fprintf(fpout,"  ");
	  fprintf(fpout,"{");
	  for(int j=0; j<nCol-1; j++) fprintf(fpout, P_FORMAT",", Mid(mat[l](i+1,j+1)));
	  fprintf(fpout, P_FORMAT" },\n", Mid(mat[l](i+1,nCol)));
        }
        if (nRow>1) fprintf(fpout, "  {");
        for (int j=0; j<nCol-1; j++) fprintf(fpout, P_FORMAT",", Mid(mat[l](nRow, j+1)));
        fprintf(fpout, P_FORMAT" }", Mid(mat[l](nRow,nCol)));
        if (nRow>1) fprintf(fpout, "   }\n");
         else fprintf(fpout, "\n");
      }
      else
      {
        for(int i=0; i<ColDimension(smat[l]); i++)
	{
	  for (int j=smat[l].colStarts[i]; j<smat[l].colStarts[i+1]; j++)
	  {
	    fprintf(fpout, "(%u,%u)", smat[l].rowIndices[j], i);
	    fprintf(fpout, P_FORMAT, BiasMid(&smat[l].theElements[j]));
	    if (j == smat[l].colStarts[ColDimension(smat[l])]-1) fprintf(fpout, "}\n");
	      else fprintf(fpout, ",\n");
	  }
	}
      }
    }
  }
  fprintf(fpout,"} \n");
}
开发者ID:nberth,项目名称:apron4opam,代码行数:45,代码来源:vSDP_struct.cpp


示例17: ReverseFind

//--------------------------------------------------------------------------------
CString CPathString::GetExtension()
{
    int nIndex = ReverseFind('.');
    CString sTemp;

    if(nIndex != -1)
        sTemp = Mid(nIndex);

    return sTemp;
}
开发者ID:richschonthal,项目名称:Security-Server,代码行数:11,代码来源:PathString.cpp


示例18: SpanIncluding

CBSString CBSString::GetToken()
{
    CBSString ct;
    ct = SpanIncluding(separators);	// skip white space
    if (ct.GetLength())
	ct = Mid(ct.GetLength());
    else
	ct = (const char *) this[0];
    ct = ct.SpanExcluding(separators);
    return (ct);
}
开发者ID:calumchisholm,项目名称:XPilotNG-web,代码行数:11,代码来源:BSString.cpp


示例19: Instr

int Instr(char *SearchString, char *SearchTerm)
{
    int ReturnValue = -1;
    for (int i = 0 ; i <= strlen(SearchString)-strlen(SearchTerm); i++)
    {
        if (SearchTerm == Mid(SearchString, i, strlen(SearchTerm)))
        {
            ReturnValue ++;
        }
    }
    return ReturnValue;
}
开发者ID:minho1126,项目名称:sManager,代码行数:12,代码来源:Pulsecor.cpp


示例20: Mid

BOOL CParseString::GetNextWord(CString& word)
{
    int i, j;
    word.Empty();
    for (i = m_CurIndex; i < GetLength() && IsSeparator(i); i++);
    if (i >= GetLength()) return FALSE;
    for (j = i; j < GetLength() && !IsSeparator(j); j++) ;
    word = Mid(i, j-i);
    RemoveQuote(word);
    m_CurIndex = j;
    return TRUE;
}
开发者ID:vinnie38170,项目名称:klImageCore,代码行数:12,代码来源:MyString.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ MikMod_free函数代码示例发布时间:2022-05-30
下一篇:
C++ Microseconds函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap