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


C++ wstring::at方法代码示例

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


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

示例1: GetString

bool CRealTextParser::GetString(wstring& p_rszLine, unsigned int& p_riPos, wstring& p_rszString, const wstring& p_crszEndChars)
{
    while (p_rszLine.length() > p_riPos && p_crszEndChars.find(p_rszLine.at(p_riPos)) == wstring::npos) {
        p_rszString += p_rszLine.at(p_riPos);
        ++p_riPos;
    }

    return p_rszLine.length() > p_riPos;
}
开发者ID:AeonAxan,项目名称:mpc-hc,代码行数:9,代码来源:RealTextParser.cpp

示例2: ExtractString

bool CRealTextParser::ExtractString(wstring& p_rszLine, wstring& p_rszString)
{
	if (p_rszLine.length() == 0 || p_rszLine.at(0) == '<')
	{
		if (m_bTryToIgnoreErrors)
		{
			p_rszString = L"";
			return true;
		}
		else
		{
			return false;
		}
	}

	unsigned int iPos = 0;

	if (!SkipSpaces(p_rszLine, iPos))
		return false;

	if (!GetString(p_rszLine, iPos, p_rszString, L"<"))
		return false;

	p_rszLine = p_rszLine.substr(iPos);
	return true;
}
开发者ID:Fluffiest,项目名称:mpc-hc,代码行数:26,代码来源:RealTextParser.cpp

示例3: injectStringEntry

void XDBF::injectStringEntry(wstring wstr, unsigned long long id)
{
    // if no id was provided, then we need to get the next available one
    if (id == 0)
        id = getNextId(ET_STRING);

    // create a character array to hold the data to write, we need to
    // make a copy so that we can reverse the endian of the wstring
    unsigned short *dataToWrite = new unsigned short[wstr.length() + 1];

    // copy the characters to the array
    for (int i = 0; i < wstr.length(); i++)
    {
        dataToWrite[i] = (unsigned short)wstr.at(i);
        SwapEndian(&dataToWrite[i], 1, 2);
    }

    dataToWrite[wstr.length()] = 0;

    // inject the new string entry
    injectEntry_private(ET_STRING, (char*)dataToWrite, WSTRING_BYTES(wstr.length()), id);

    // give the memory back
    delete[] dataToWrite;
}
开发者ID:changbiao,项目名称:XDBF-Manager,代码行数:25,代码来源:xdbf.cpp

示例4:

vector<int> CJPWordsVector::makeTone(wstring str)
{
	//目标整形数组
	vector<int> tone;
	//分割符为英文逗号
	wchar_t flag = ',';
	//起始位置
	size_t start = 0;
	//结束位置
	size_t end = 0 ;
	for( ; end<str.size(); end++ )
	{
		//当前符号位分隔符
		if(str.at( end )== flag)
		{
			//截取子串
			wstring numStr = str.substr(start,end-start);
			//转换成数字加入数组
			int num = _wtoi(numStr.c_str());
			tone.push_back(num);
			//跳过分割符
			end++;
			//移动开始位置
			start = end;
		}
	}
	//截取子串
	wstring numStr = str.substr(start,end-start);
	//转换成数字加入数组
	int num = _wtoi(numStr.c_str());
	tone.push_back(num);
	return tone;
}
开发者ID:gyk001,项目名称:JPWord,代码行数:33,代码来源:JPWordsVector.cpp

示例5: FixPath

bool FixPath(wstring& path) {
	// Fix unix paths
	std::replace( path.begin(), path.end(), L'/', L'\\' );

	// Remove double slashes
	while(true) {
		size_t p = path.find(L"\\\\");
		if (p == string::npos) break;
		path.replace(p, 2, L"\\");
	}


	// Are we pointing at a real destination?
	if (DirectoryExists(path)) {
		if (path[path.length()-1] != L'\\')
			path += L'\\';
		return true;
	} else if (path.at(path.length() - 1) == L'\\') {
		// It says its a directory but it's not, must be a file
		path = path.substr(0, path.length() - 1);
	}

	return FileExists(path);
	
}
开发者ID:Cache22,项目名称:Launchy,代码行数:25,代码来源:Explory.cpp

示例6: GetCommonCharIndex

int GetCommonCharIndex(wchar_t c) {
  for (size_t i = 0; i < kCommonCharTable.size(); i++)
    if (kCommonCharTable.at(i) == c)
      return i;

  return -1;
}
开发者ID:vjcagay,项目名称:taiga,代码行数:7,代码来源:string.cpp

示例7: StringToLower

wstring CRealTextParser::StringToLower(const wstring& p_crszString)
{
    wstring szLowercaseString;
    for (unsigned int i = 0; i < p_crszString.length(); ++i) {
        szLowercaseString += towlower(p_crszString.at(i));
    }
    return szLowercaseString;
}
开发者ID:AeonAxan,项目名称:mpc-hc,代码行数:8,代码来源:RealTextParser.cpp

示例8: updateSuffix

/**
 * add a suffix with _basicFeatureListId and _featureListid to trie
 */
void SuffixModelTrie::updateSuffix(wstring _suffix, int _basicFeatureListId, int _featureListId)
{
	SuffixModelNode* currentNode = root;
	for (int i = (int) _suffix.length() - 1; i >= 0; --i)
	{
		SuffixModelNode* tmpNode = currentNode->findChildNode(_suffix.at(i));
		if (tmpNode == NULL)
		{
			tmpNode = new SuffixModelNode(_suffix.at(i));
			numberOfNodes++;
			currentNode->addChildNode(tmpNode);
		}
		tmpNode->updateFeature(_basicFeatureListId, _featureListId);
		updateFeatureId(_basicFeatureListId, _featureListId);
		currentNode = tmpNode;
	}
}
开发者ID:Samsung,项目名称:veles.nlp,代码行数:20,代码来源:SuffixModelTrie.cpp

示例9: SkipSpaces

bool CRealTextParser::SkipSpaces(wstring& p_rszLine, unsigned int& p_riPos)
{
    while (p_rszLine.length() > p_riPos && iswspace(p_rszLine.at(p_riPos))) {
        ++p_riPos;
    }

    return p_rszLine.length() > p_riPos;
}
开发者ID:AeonAxan,项目名称:mpc-hc,代码行数:8,代码来源:RealTextParser.cpp

示例10: getMorphologicalPrediction

void MorphologicalDictionary::getMorphologicalPrediction(const wstring & lower_word,
        shared_ptr<vector<shared_ptr<Morphology> > > result)
{
    prediction_count++;

    bool debug = false;
    int l = lower_word.length();
    if (debug)
    {
        wcout << "Prediction: Word = " << lower_word << " length = " << l << endl;
    }
    shared_ptr<SuffixNode> current_node = suffix_root;
    for (int i = l - 1; i >= 0; --i)
    {
        wchar_t character = lower_word.at(i);
        map<wchar_t, shared_ptr<SuffixNode> >::iterator scn_iter
            = current_node->children.find(character);
        if (scn_iter != current_node->children.end())
        {
            current_node = scn_iter->second;
        }
        else
        {
            for (vector<int>::iterator
                    m_iter = current_node->suffix_trie_model_ids.begin();
                    m_iter != current_node->suffix_trie_model_ids.end(); ++m_iter)
            {
                int suffix_model_id = *m_iter;
                shared_ptr<SuffixModel> suffix_model = suffix_models.at(suffix_model_id);
                if (suffix_model->feature_list_id <= 0)
                {
                    continue;
                }

                shared_ptr<Morphology> morphology = std::make_shared<Morphology>();
                morphology->lemma_id = 0;
                morphology->suffix_length = l - 1 - i;
                // lemma
                shared_ptr<wstring> lemma = make_shared<wstring>(lower_word, 0, i + 1);
                lemma->append(suffix_model->lemma_suffix);
                morphology->lemma = lemma;
                morphology->word = make_shared<wstring>(lower_word);

                // feature from current model elements
                for (vector<int>::iterator
                        f_iter = id_feature_list.at(suffix_model->feature_list_id).begin();
                        f_iter != id_feature_list.at(suffix_model->feature_list_id).end();
                        ++f_iter)
                {
                    morphology->features.push_back(id_short_feature.at(*f_iter));
                    morphology->descriptions.push_back(id_long_feature.at(*f_iter));
                }
                result->push_back(morphology);
            }
            break;
        }
    }
}
开发者ID:Samsung,项目名称:veles.nlp,代码行数:58,代码来源:MorphologicalDictionary.cpp

示例11: _Replace

void base_string::_Replace(wstring &src, const wchar_t cOld, const wchar_t cNew)
{
	size_t nSize = src.size();
	for(size_t i=0; i<nSize; ++i)
	{
		if(src.at(i) == cOld)
			src[i] = cNew;
	}
}
开发者ID:lynebetos,项目名称:BusStopTerminal,代码行数:9,代码来源:base_string.cpp

示例12: GetTimecode

int CRealTextParser::GetTimecode(const wstring& p_crszTimecode)
{
	int iTimecode(0);
	int iMultiplier(1);

	// Exception: if the timecode doesn't contain any separators, assume the time code is in seconds (and change multiplier to reflect that)
	if (p_crszTimecode.find_first_of('.') == wstring::npos && p_crszTimecode.find_first_of(':') == wstring::npos)
		iMultiplier = 1000;

	wstring szCurrentPart;

	for (int i = p_crszTimecode.length() - 1; i >= 0; --i)
	{
		if (p_crszTimecode.at(i) == '.' || p_crszTimecode.at(i) == ':')
		{
			if (iMultiplier == 1)
			{
				while (szCurrentPart.length() < 3)
					szCurrentPart += L"0";
			}

			iTimecode += iMultiplier * ::_wtoi(szCurrentPart.c_str());

			if (iMultiplier == 1)
			{
				iMultiplier = 1000;
			}
			else
			{
				iMultiplier *= 60;
			}

			szCurrentPart = L"";
		}
		else
		{
			szCurrentPart = p_crszTimecode.substr(i, 1) + szCurrentPart;
		}
	}

	iTimecode += iMultiplier * ::_wtoi(szCurrentPart.c_str());

	return iTimecode;
}
开发者ID:Fluffiest,项目名称:mpc-hc,代码行数:44,代码来源:RealTextParser.cpp

示例13: getSubStringWidth

float XFont::getSubStringWidth(const wstring &s, int begin, int end)
{
    float width = 0;

    for (int i = begin; i < end; i++)
    {
        width += getCharWidth(s.at(i));
    }

    return width;
}
开发者ID:MoonActive,项目名称:chronotext-toolkit,代码行数:11,代码来源:XFont.cpp

示例14: if

void zpt::html::entities_encode(wstring s, ostream& out, bool quote, bool tags) {
	ostringstream oss;
	for (size_t i = 0; i != s.length(); i++) {
		if (((unsigned char)s[i]) > 127) {
			oss << "&#" << dec << ((int)s.at(i)) << ";";
		} else if (s[i] == '"' && quote) {
			oss << "&quot;";
		} else if (s[i] == '<' && tags) {
			oss << "&lt;";
		} else if (s[i] == '>' && tags) {
			oss << "&gt;";
		} else if (s[i] == '&') {
			oss << "&amp;";
		} else {
			oss << ((char)s.at(i));
		}
	}
	oss << flush;
	out << oss.str();
}
开发者ID:naazgull,项目名称:zapata,代码行数:20,代码来源:html.cpp

示例15: ReplaceChar

void ReplaceChar(wstring& str, const wchar_t c, const wchar_t replace_with) {
  if (c == replace_with)
    return;

  size_t pos = 0;

  do {
    pos = str.find_first_of(c, pos);
    if (pos != wstring::npos)
      str.at(pos) = replace_with;
  } while (pos != wstring::npos);
}
开发者ID:vjcagay,项目名称:taiga,代码行数:12,代码来源:string.cpp


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