本文整理汇总了C++中wstring::find方法的典型用法代码示例。如果您正苦于以下问题:C++ wstring::find方法的具体用法?C++ wstring::find怎么用?C++ wstring::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wstring
的用法示例。
在下文中一共展示了wstring::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: urlSuitableForTestResult
wstring urlSuitableForTestResult(const wstring& url)
{
if (!url.c_str() || url.find(L"file://") == wstring::npos)
return url;
return PathFindFileNameW(url.c_str());
}
示例2: bindBuiltinVariable
/***************************************************************************
* bindBuiltinVariable
***************************************************************************/
bool CCilVm::bindBuiltinVariable( const wstring& strQualifiedName,
CVariable* const pvar )
{
bool bReturn = true;
//Bind the var
if( strQualifiedName.find( STRING_INTERNAL_SCOPEDELIMITER ) != wstring::npos )
{
wstring strRoot = strQualifiedName.substr( 0, strQualifiedName.rfind( STRING_INTERNAL_SCOPEDELIMITER ) );
assert( strRoot.find( STRING_INTERNAL_SCOPEDELIMITER ) == wstring::npos );
wstring strLeaf = strQualifiedName.substr( strQualifiedName.rfind( STRING_INTERNAL_SCOPEDELIMITER ) + 1,
strQualifiedName.length() );
RID ridObject = getMetaData().queryBuiltinObjectRid( strRoot );
if( ridObject == RID_NOTDEFINED )
return false;
//Create property
getPrototypeObject( ridObject ).setProperty( strLeaf,
*pvar );
}
return bReturn;
}
示例3: fillExplicitTableHeadersForCell
/*
* Adds table header info for a single cell which explicitly defines headers
* using the Headers attribute.
*/
inline void fillExplicitTableHeadersForCell(AdobeAcrobatVBufStorage_controlFieldNode_t& cell, int docHandle, wstring& headersAttr, TableInfo& tableInfo) {
wostringstream colHeaders, rowHeaders;
// The Headers attribute string is in the form "[[id id ... ]]"
// Loop through all the ids.
// Ignore the "[[" prefix and the " ]]" suffix.
size_t lastPos = headersAttr.length() - 3;
size_t startPos = 2;
while (startPos < lastPos) {
// Search for a space, which indicates the end of this id.
size_t endPos = headersAttr.find(L' ', startPos);
if (endPos == wstring::npos)
break;
// headersAttr[startPos:endPos] is the id of a single header.
// Find the info for the header associated with this id string.
map<wstring, TableHeaderInfo>::const_iterator it = tableInfo.headersInfo.find(headersAttr.substr(startPos, endPos - startPos));
startPos = endPos + 1;
if (it == tableInfo.headersInfo.end())
continue;
if (it->second.type & TABLEHEADER_COLUMN)
colHeaders << docHandle << L"," << it->second.uniqueId << L";";
if (it->second.type & TABLEHEADER_ROW)
rowHeaders<< docHandle << L"," << it->second.uniqueId << L";";
}
if (colHeaders.tellp() > 0)
cell.addAttribute(L"table-columnheadercells", colHeaders.str());
if (rowHeaders.tellp() > 0)
cell.addAttribute(L"table-rowheadercells", rowHeaders.str());
}
示例4: parse
int WinContactSIF::parse(const wstring & data) {
if (!sifFields) {
LOG.error("%s", ERR_SIFFIELDS_NULL);
return 1;
}
propertyMap.clear();
// Check if <contact> tag is present...
wstring::size_type pos = 0;
wstring itemTypeTag = L"<contact>";
pos = data.find(itemTypeTag, 0);
if (pos == wstring::npos) {
LOG.error("Tag '%ls' not found", itemTypeTag.c_str());
return 1;
}
wstring propertyValue;
for (int i=0; sifFields[i]; i++) {
// Set only properties found!
if (!getElementContent(data, sifFields[i], propertyValue, 0)) {
replaceAll(L"<", L"<", propertyValue);
replaceAll(L">", L">", propertyValue);
replaceAll(L"&", L"&", propertyValue);
setProperty(sifFields[i], propertyValue);
}
}
return 0;
}
示例5: IsURL
bool IsURL(wstring const &str)
{
if(str.find(TEXT(" "), 0) != wstring::npos)
{
return false;
}
wstring upr(UpperCase(str));
if(upr.compare(0, 7, TEXT("HTTP://")) == 0 || upr.compare(0, 8, TEXT("HTTPS://")) == 0)
{
return true;
}
WCHAR **tld = gTopLevelDomains;
while(*tld != nullptr)
{
if(upr.find(*tld, 0) != wstring::npos)
{
return true;
}
++tld;
}
return false;
}
示例6: setCurrentFile
bool FileList::setCurrentFile(const wstring ¤t_file)
{
wstring base_path = FilePath::cleanUpPath(_baseDirectory.getPath()) + L"\\";;
if (current_file.find(base_path) != 0) {
return false;
}
if (base_path.length() == current_file.length()) {
return false;
}
vector<wstring> split_path;
FilePath::splitFilePath(current_file.substr(base_path.length()), split_path);
wstring current_path = base_path;
for (vector<wstring>::iterator i = split_path.begin(); i != split_path.end(); ++i) {
wstring name = *i;
current_path += name + L"\\";
FileInfo fileInfo(current_path);
if (fileInfo.isDirectory()) {
Directory *next_directory = new Directory(current_path);
_directories.top()->setCurrentSubDirectory(name);
_directories.push(next_directory);
}
else if (fileInfo.isFile()) {
return _directories.top()->setCurrentFile(name);
}
else {
return false;
}
}
return false;
}
示例7: interpolate
wstring QueryAssembler::interpolate(const wstring& rule, const shared_ptr<IMatch>& match, const NetEvaluator& evaluator)
{
unordered_map<wstring, wstring> evaluation = evaluator.Evaluate(match, currentFrameTense); //evaluator calculates all values which could be interpolated into the template
wstring filler;
wstring toReturn = rule;
size_t c_pos = 0;
size_t pos = 0;
while((pos = rule.find(L"${", c_pos)) != wstring::npos) //replace all placeholders in the template with calculated values
{
size_t pos2 = rule.find(L"}", pos);
if(pos2 == wstring::npos)
{
throw EInvalidSlotRule(match->GetNetName().c_str());
}
wstring placeHolder = rule.substr(pos + 2, pos2 - pos - 2);
size_t point_pos;
if((point_pos = placeHolder.find(L".")) != wstring::npos) //reference to subfield ".field" is supported
{
wstring field = placeHolder.substr(point_pos + 1);
if(evaluation.find(field) == evaluation.end())
{
throw ENoExistingFieldReference(match->GetNetName().c_str());
}
filler = evaluation.at(field);
}
else
{
filler = evaluation.at(NetEvaluator::VALUE); //if no field is referenced field .VALUE is referenced by default
}
c_pos = pos2;
size_t repl1 = toReturn.find(L"${");
size_t repl2 = toReturn.find(L"}") + 1;
toReturn.replace(repl1, repl2 - repl1, filler);
}
return toReturn;
}
示例8: ChgText
void CParseSearchChgText::ChgText(wstring& chgText)
{
for( size_t i = 0; i<this->chgKey.size(); i++ ){
if( chgText.find( this->chgKey[i].oldText ) != string::npos ){
Replace(chgText, this->chgKey[i].oldText, this->chgKey[i].newText);
}
}
}
示例9: substr_after
wstring substr_after(const wstring& s, const wstring& skip) {
size_t p = s.find(skip);
if (p == wstring::npos) {
return NULL;
}
return s.substr(skip.length() + p);
}
示例10:
wstring
Utils::get_tag_value(wstring tags, wstring values) {
vector<wstring> pval=StringUtils::split_wstring(values,L"|");
for(wstring::size_type i=0; i<pval.size(); i++) {
if (tags.find(pval[i]) != wstring::npos)
{
int pos=tags.find(pval[i]);
if( (pos==0 || tags[pos-1]==L'.') && (pos==tags.size()-1 || tags[pos+1]==L'.'))
return pval[i];
else
return L"";
}
}
return L"";
}
示例11: getAbsolutePath
// 根据相对路径获取绝对路径
// 如果relativePath已经是绝对路径,则直接返回
// 否则将返回appPath+relativePath
wstring getAbsolutePath(wstring &relativePath, wstring &appPath){
if (relativePath.find(L":") == -1){// 如果指定的路径是相对路径
wstring _path(appPath);
_path.append(relativePath);
return _path;
}
return relativePath;
}
示例12: StatusCodeAnalysis
bool Inet::StatusCodeAnalysis(wstring sctext,int* res){
int i,n,pos;
wchar_t *err;
if(pos=sctext.find(' ')==wstring::npos){
return false;
}
sctext.erase(0,pos+1);
if(pos=sctext.find(' ')==wstring::npos){
return false;
}
sctext.erase(pos);
*res=wcstol(sctext.c_str(),&err,10);
if(lstrlen(err)!=0){
return false;
}
return true;
}
示例13: 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;
}
示例14: doReplace
wstring NBTools::doReplace(wstring text, wstring find, wstring replace)
{
while (true)
{
size_t pos = text.find(find);
if (0 > pos || pos > text.length()) return text;
text = text.replace(pos, find.length(), replace);
}
}
示例15: move
template<> void WXML::constructKey(wstring &str)
{
long startX = str.find('<') + 1;
long endX =
Math::calcMin<long>
(
{
indexFilter(str.find(' ', startX)),
indexFilter(str.find('\n', startX)),
indexFilter(str.find('\t', startX)),
indexFilter(str.find('>', startX)),
indexFilter(str.find('/', startX))
}
).getValue();
//Determinate the KEY
key = move(WStringUtil::substring(str, startX, endX));
}