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


C++ String::Contains方法代码示例

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


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

示例1: DisplayText

result Enrollment::DisplayText(ByteBuffer& txBuffer, unsigned long buflen) {
	String data;
	char* pBuffer = null;
	result res = E_SUCCESS;

	txBuffer.Flip();
	pBuffer = (char*) (txBuffer.GetPointer());
	data.SetCapacity(buflen + 20);
	res = data.Append(pBuffer);
	TryReturn(res == E_SUCCESS, res, "Append Failed");

	txBuffer.Clear();

	if (data == L"__HELLO__") {
		EnableControl(true);
		__isConnected = true;
		return res;
	}

	if (__isConnected == false) {
		AppLog(
				"Server hasn't received Initial message so all incoming content is discarded");
		// Remove created NetEndPoint
		delete __pUdpEndpoint;
		__pUdpEndpoint = null;
		return res;
	}

	if (data == L"__CLOSE__") {
		SceneManager* pSceneManager = SceneManager::GetInstance();
		AppAssert(pSceneManager);

		pSceneManager->GoBackward(BackwardSceneTransition(SCENE_CALENDAR));

		OnClose();
		return res;
	}

	int i = 0;
	if (data.Contains(__pWorkList[i]->GetText())) {
		__pWorkList[i++]->SetSelected(true);
	}
	if (data.Contains(__pWorkList[i]->GetText())) {
		__pWorkList[i++]->SetSelected(true);
	}
	if (data.Contains(__pWorkList[i]->GetText())) {
		__pWorkList[i++]->SetSelected(true);
	}
	if (data.Contains(__pWorkList[i]->GetText())) {
		__pWorkList[i++]->SetSelected(true);
	}

	TryReturn(res == E_SUCCESS, res, "AppendText Failed");

	for (int k = 0; k < MAX_WORK_COUNT; k++) {
		__pWorkList[k]->RequestRedraw();
	}

	return res;
}
开发者ID:ajouSE-TeamE,项目名称:SE_TizenProgectTeamE,代码行数:60,代码来源:Enrollment.cpp

示例2: JumpToNextConditional

void Script::JumpToNextConditional()
{
	// If the statement is not true, find an else or endif block..!
	for (int i = currentLine; i < lines.Size(); ++i){
		String l = lines[i];
		if (l.Contains("elsif"))
		{
			std::cout<<"\nJumpToNextConditional: "<<l;
			currentLine = i;
			// Call this function again?
			EvaluateLine(lines[i]);
			return;
		}
		else if (l.Contains("else"))
		{
			/// Jump to this row ^^
			currentLine = i;
			lineFinished = true;
			return;
		}
		else if (l.Contains("endif")){
			currentLine = i;
			lineFinished = true;
			return;
		}
	}
}
开发者ID:erenik,项目名称:engine,代码行数:27,代码来源:Script.cpp

示例3: LoadFromString

// Let's say you don't know if the input string is raw base64, or if it has
// bookends
// on it like -----BEGIN BLAH BLAH ...
// And if it DOES have Bookends, you don't know if they are escaped:  -
// -----BEGIN ...
// Let's say you just want an easy function that will figure that crap out, and
// load the
// contents up properly into an OTASCIIArmor object. (That's what this function
// will do.)
//
// str_bookend is a default.
// So you could make it more specific like, -----BEGIN ENCRYPTED KEY (or
// whatever.)
//
// static
bool OTASCIIArmor::LoadFromString(OTASCIIArmor& ascArmor,
                                  const String& strInput,
                                  std::string str_bookend)
{

    if (strInput.Contains(str_bookend)) // YES there are bookends around this.
    {
        const std::string str_escaped("- " + str_bookend);

        const bool bEscaped = strInput.Contains(str_escaped);

        String strLoadFrom(strInput);

        if (!ascArmor.LoadFromString(strLoadFrom, bEscaped)) // removes the
                                                             // bookends so we
                                                             // have JUST the
                                                             // coded part.
        {
            //          otErr << "%s: Failure loading string into OTASCIIArmor
            // object:\n\n%s\n\n",
            //                        __FUNCTION__, strInput.Get());
            return false;
        }
    }
    else
        ascArmor.Set(strInput.Get());

    return true;
}
开发者ID:Kodachi75,项目名称:opentxs,代码行数:44,代码来源:OTASCIIArmor.cpp

示例4: ToFormat

String DateTime::ToFormat(const String& format) const
{
	String s = format.IsEmpty() ? "M/D/YYYY" : format;
	TimeSpan t = *this;
	String ampm = "am";
	if (s.Contains("am/pm") || s.Contains("AM/PM"))
	{
		s = s.Replace("am/pm", "{4}");
		s = s.Replace("AM/PM", "{5}");
		if (t.Hours() >= 12)
		{
			t = t.AddHours(-12);
			ampm = "pm";
		}
		else if (t.Hours() == 0)
			t = t.AddHours(12);
	}
	String AMPM = ampm.ToUpper();
	YearString y(*this);
	MonthString m(*this);
	DayString d(*this);
	s = s
		.Replace("YYYY", "{0:~~~~}")
		.Replace("YY", "{0:~~}")
		.Replace("MMMM", "{1:~~~~}")
		.Replace("MMM", "{1:~~~}")
		.Replace("MM", "{1:~~}")
		.Replace("M", "{1}")
		.Replace("DDDD", "{2:~~~~}")
		.Replace("DDD", "{2:~~~}")
		.Replace("DD", "{2:~~}")
		.Replace("D", "{2}")
		.Replace("hh", "{3:HH}")
		.Replace("h", "{3:H}")
		.Replace("mm", "{3:MM}")
		.Replace("m", "{3:M}")
		.Replace("ss", "{3:SS}")
		.Replace("s", "{3:S}")
		.Replace("nnn", "{3:NNN}")
		.Replace("nn", "{3:NN}")
		.Replace("n", "{3:N}")
		.Replace("{3:HH}", "{3:hh}")
		.Replace("{3:H}", "{3:h}")
		.Replace("{3:MM}", "{3:mm}")
		.Replace("{3:M}", "{3:m}")
		.Replace("{3:SS}", "{3:ss}")
		.Replace("{3:S}", "{3:s}")
		.Replace("{3:NNN}", "{3:nnn}")
		.Replace("{3:NN}", "{3:nn}")
		.Replace("{3:N}", "{3:n}");
	if (s.Contains("{4}"))
		s = s.Replace("{4}", ampm);
	if (s.Contains("{5}"))
		s = s.Replace("{5}", AMPM);
	return Format(s, y, m, d, t);
}
开发者ID:sysrpl,项目名称:Codebot.Cpp,代码行数:56,代码来源:DateTime.cpp

示例5: Import

bool ModelImporter::Import()
{
    String modelAssetFilename = asset_->GetPath();

    importNode_ = new Node(context_);

    // skip external animations, they will be brought in when importing their
    // corresponding model
    if (!modelAssetFilename.Contains("@"))
    {
        ImportModel();

        if (importAnimations_)
        {
            ImportAnimations();
        }

    }

    File outFile(context_);

    if (!outFile.Open(asset_->GetCachePath(), FILE_WRITE))
        ErrorExit("Could not open output file " + asset_->GetCachePath());

    importNode_->SaveXML(outFile);

    importNode_ = 0;

    return true;
}
开发者ID:WorldofOpenDev,项目名称:AtomicGameEngine,代码行数:30,代码来源:ModelImporter.cpp

示例6: TryCreateStorage

AssetStoragePtr HttpAssetProvider::TryCreateStorage(HashMap<String, String> &storageParams, bool fromNetwork)
{
    if (!storageParams.Contains("src") || !IsValidRef(storageParams["src"], ""))
        return AssetStoragePtr();
    if (storageParams.Contains("type") && storageParams["type"].Compare("HttpAssetStorage", false) != 0)
        return AssetStoragePtr();

    String baseUrl = storageParams["src"];
    if (!baseUrl.EndsWith("/") && baseUrl.Contains("/"))
        baseUrl = baseUrl.Substring(0, baseUrl.FindLast('/')+1);
    if (!baseUrl.EndsWith("/"))
        return AssetStoragePtr();

    String name = UniqueName(storageParams["name"]);

    // @todo liveupdate, liveupload, autodiscoverable etc. when actually needed
    AssetStoragePtr storage = StorageForBaseURL(baseUrl);
    if (!storage)
    {
        storage = AssetStoragePtr(new HttpAssetStorage(framework_->GetContext(), name, baseUrl, storageParams["localdir"]));
        httpStorages_.Push(storage);
    }

    storage->SetReplicated(Urho3D::ToBool(storageParams["replicated"]));
    return storage;
}
开发者ID:antont,项目名称:tundra-urho3d,代码行数:26,代码来源:HttpAssetProvider.cpp

示例7: UserGroup

UserGroup *UserGroup::MatchFilter(const String &filter) {
	UserGroup *filteredGroup = null;
	String filterLowerCase;
	filter.ToLowerCase(filterLowerCase);

	for(int i = 0; i < _pUserList->GetCount(); i++) {
		JsonObject *user;
		String firstName;
		String lastName;
		String fullName;

		JsonParseUtils::GetObject(_pUserList, i, user);
		JsonParseUtils::GetString(*user, L"first_name", firstName);
		JsonParseUtils::GetString(*user, L"last_name", lastName);
		(firstName + L" " + lastName).ToLowerCase(fullName);

		if(fullName.Contains(filterLowerCase)) {
			if(filteredGroup == null) {
				filteredGroup = new UserGroup();
				filteredGroup->Construct(*_pGroupName);
			}

			filteredGroup->_pUserList->Add(user);
		}
	}

	return filteredGroup;
}
开发者ID:igorglotov,项目名称:tizen-vk-client,代码行数:28,代码来源:UserGroup.cpp

示例8: Guard

/** Used to tokenize with some characters used to start and stop the tokenization procedure temporarily.
	Sample use-case would be to tokenize the string "Aim(7,3), Guard(2,3)" and returning "Aim(7,3)" and "Guard(2,3)",
	using the tokenizer ',' and ignoreparts "()". 
	Ignore parts should be in pairs, one starting the ignore part, the other stopping it.
*/
List<String> TokenizeIgnore(String string, String tokenizers, String ignoreParts)
{
	List<String> tokens;
	int inIgnorePart = 0;
	const char * cString = string.c_str();
	String str;
	for (int i = 0; i < string.Length(); ++i)
	{
		char c = cString[i];
		for (int i = 0; i < ignoreParts.Length(); i += 2)
		{
			if (c == ignoreParts.c_str()[i])
				++inIgnorePart;
			if (c == ignoreParts.c_str()[i+1])
				--inIgnorePart;
		}

		if (tokenizers.Contains(c) && inIgnorePart == 0)
		{
			tokens.Add(str);
			str = String();
		}
		else 
		{
			str += c;
		}
	}
	// Add final one.
	tokens.Add(str);
	return tokens;
}
开发者ID:erenik,项目名称:engine,代码行数:36,代码来源:StringUtil.cpp

示例9: lock

void UEventObserver::UEventThread::SendEvent(
    /* [in] */ const String& message)
{
    {
        AutoLock lock(mKeysAndObserversLock);

        List< AutoPtr<IInterface> >::Iterator it = mKeysAndObservers.Begin();
        while (it != mKeysAndObservers.End()) {
            AutoPtr<ICharSequence> csStr = ICharSequence::Probe(*it);
            assert(csStr != NULL);
            String key;
            csStr->ToString(&key);
            if (message.Contains(key)) {
                List< AutoPtr<IInterface> >::Iterator tmpIt = it;
                AutoPtr<IInterface> obj = *(++tmpIt);
                AutoPtr<UEventObserver> observer = (UEventObserver*)IObject::Probe(obj);
                mTempObserversToSignal.PushBack(observer);
            }
            ++it;
            ++it;
        }
    }

    if (!mTempObserversToSignal.IsEmpty()) {
        AutoPtr<UEvent> event = new UEvent(message);
        List< AutoPtr<UEventObserver> >::Iterator it;
        for (it = mTempObserversToSignal.Begin(); it != mTempObserversToSignal.End(); ++it) {
            AutoPtr<UEventObserver> observer = *it;
            observer->OnUEvent(event);
        }
        mTempObserversToSignal.Clear();
    }
}
开发者ID:TheTypoMaster,项目名称:ElastosRDK5_0,代码行数:33,代码来源:UEventObserver.cpp

示例10: Error

FileFormat::FileFormat( const String& nameExtOrMime, bool toRead, bool toWrite ) :
   FileFormatBase()
{
   if ( nameExtOrMime.IsEmpty() )
      throw Error( "FileFormat: Empty format name, file extension or MIME type specified" );

   m_data = new FileFormatPrivate;

   if ( nameExtOrMime.Contains( '/' ) )
   {
      IsoString mimeType( nameExtOrMime );
      m_data->handle = (*API->FileFormat->GetFileFormatByMimeType)( ModuleHandle(), mimeType.c_str(), toRead, toWrite );
      if ( m_data->handle == nullptr )
         throw Error( "FileFormat: No installed image file format was found "
                      "for the specified MIME type \'" + nameExtOrMime + "\' and access conditions" );
   }
   else if ( nameExtOrMime.StartsWith( '.' ) )
   {
      m_data->handle = (*API->FileFormat->GetFileFormatByFileExtension)( ModuleHandle(), nameExtOrMime.c_str(), toRead, toWrite );
      if ( m_data->handle == nullptr )
         throw Error( "FileFormat: No installed image file format was found "
                      "for the specified file extension \'" + nameExtOrMime + "\'and access conditions" );
   }
   else
   {
      IsoString id( nameExtOrMime );
      m_data->handle = (*API->FileFormat->GetFileFormatByName)( ModuleHandle(), id.c_str() );
      if ( m_data->handle == nullptr )
         throw Error( "FileFormat: No installed image file format was found "
                      "with the specified identifier \'" + nameExtOrMime + '\'' );
   }

   m_data->GetCapabilities();
}
开发者ID:SunGong1993,项目名称:PCL,代码行数:34,代码来源:FileFormat.cpp

示例11: EndCutscene

void Script::EndCutscene(bool endingPrematurely /*= false*/)
{
	// Make sure we're in a cutscene first..
	if (!inCutscene)
		return;
	if (endingPrematurely)
	{
		// Jump to the end of the cutscene.
		for (int i = currentLine; i < lines.Size(); ++i)
		{
			// Look for the end.
			String line = lines[i];
			if (line.Contains("End(Cutscene)"))
			{
				// Jump to it.
				currentLine = i;
				// Stop doing whatever we were doing too.
				lineFinished = true;
				break;
			}
		} 
	}
	// End all sub-scripts too!
	for (int i = 0; i < childScripts.Size(); ++i)
	{
		Script * script = childScripts[i];
		script->QueueEnd();
	}

	inCutscene = false;
}
开发者ID:erenik,项目名称:engine,代码行数:31,代码来源:Script.cpp

示例12: Load

bool Project::Load(const String& fullpath)
{
    loading_ = true;

    if (fullpath.Contains(".atomic")) {

        projectPath_ = AddTrailingSlash(GetPath(fullpath));
        projectFilePath_ = fullpath;

    }
    else
    {
        projectPath_ = AddTrailingSlash(fullpath);
        projectFilePath_ = projectPath_ + GetFileName(RemoveTrailingSlash(projectPath_)) + ".atomic";

    }


    SharedPtr<ProjectFile> pfile(new ProjectFile(context_));
    bool result = pfile->Load(this);

    loading_ = false;

    LoadBuildSettings();
    LoadUserPrefs();

    if ( true /*result*/) {
        VariantMap data;
        data[ProjectLoaded::P_PROJECTPATH] = projectFilePath_;
        SendEvent(E_PROJECTLOADED, data);
    }

    return result;
}
开发者ID:GREYFOXRGR,项目名称:AtomicGameEngine,代码行数:34,代码来源:Project.cpp

示例13:

   void
   POP3ClientConnection::ParseStateCAPASent_(const String &sData)
   {
      if (!CommandIsSuccessfull_(sData) || !sData.Contains(_T("STLS")))
      {
         // STLS is not supported.
         if (GetConnectionSecurity() == CSSTARTTLSRequired)
         {
            String message = 
               Formatter::Format("The download of messages from external account {0} failed. The external aAccount is configured to use STARTTLS connection security, but the POP3 server does not support it.", account_->GetName());
            
            LOG_APPLICATION(message)
            QuitNow_();
            return;
         }
         else
         {
            SendUserName_();
            return;
         }
      }

      EnqueueWrite_("STLS");
      current_state_ = StateSTLSSent;
   }
开发者ID:donaldlee2008,项目名称:hmailserver,代码行数:25,代码来源:POP3ClientConnection.cpp

示例14: GetNativeFunctionSignature

String CSTypeHelper::GetNativeFunctionSignature(JSBFunction* function, String& returnType)
{

    if (function->Skip())
        return String::EMPTY;

    if (function->IsDestructor())
        return String::EMPTY;

    if (OmitFunction(function))
        return String::EMPTY;

    JSBClass* klass = function->GetClass();
    JSBPackage* package = klass->GetPackage();
    String fname = function->IsConstructor() ? "Constructor" : function->GetName();

    returnType = "void";

    if (function->IsConstructor())
    {
        returnType = "RefCounted*";
    }
    else if (function->GetReturnType())
    {
        if (function->IsConstructor())
        {
            returnType = ToString("%s*", klass->GetNativeName().CString());
        }
        else if (function->GetReturnClass())
        {
            if (!function->GetReturnClass()->IsNumberArray())
            {
                returnType = ToString("const %s*", function->GetReturnClass()->GetNativeName().CString());
            }
        }
        else if (function->GetReturnType()->type_->asStringHashType())
        {
            returnType = "unsigned";
        }
        else
        {
            returnType = ToString("%s", CSTypeHelper::GetNativeTypeString(function->GetReturnType()).CString());

            // ScriptVector is handled by a out parameter
            if (returnType.Contains("ScriptVector"))
                returnType = "void";
        }
    }


    String sig;
    GenNativeFunctionParameterSignature(function, sig);

    String functionSig = ToString("csb_%s_%s_%s_%u(%s)",
                package->GetName().CString(), klass->GetName().CString(),
                fname.CString(), function->GetID(), sig.CString());

    return functionSig;
}
开发者ID:Type1J,项目名称:AtomicGameEngine,代码行数:59,代码来源:CSTypeHelper.cpp

示例15: strStartwith

ECode CTestBasicType::strStartwith(
    /* [in] */ String i,
    /* [in] */ String j,
    /* [out] */ Boolean * pO)
{
    *pO = i.Contains(j);
    return NOERROR;
}
开发者ID:sdklite,项目名称:Dalvik_CAR,代码行数:8,代码来源:CTestBasicType.cpp


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