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


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

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


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

示例1: string

	void string() {
		MAUtil::String str = "test";
		assert("String::==", str == "test");
		assert("String::!=", str != "fest");
		assert("String::<", !(str < "fest") && (MAUtil::String("fest") < str));
		assert("String::>", !(MAUtil::String("fest") > str) && (str > "fest"));
		assert("String::<=", str <= "test" && str <= "west");
		assert("String::>=", str >= "test" && str >= "fest");
		assert("String::+", (str + "ing") == "testing");
		str+="ing";
		assert("String::+=", str == "testing");
		assert("String::find()", str.find("ing") == 4 && str.find("1") == MAUtil::String::npos);
		str+=" string";
		assert("String::findLastOf()", str.findLastOf('g') == 13 && str.findLastOf('1') == MAUtil::String::npos);
		assert("String::findFirstOf()", str.findFirstOf('g') == 6 && str.findFirstOf('1') == MAUtil::String::npos);
		assert("String::findFirstNotOf()", str.findFirstNotOf('t') == 1 && str.findFirstNotOf('1') == 0);
		str.insert(7, " MAUtil::");
		assert("String::insert(string)", str == "testing MAUtil:: string");

		str.remove(16, 2);
		assert("String::remove()", str == "testing MAUtil::tring");

		str.insert(16, 'S');
		assert("String::insert(char)", str == "testing MAUtil::String");

		assert("String::substr()", str.substr(8, 6) == "MAUtil");

		assert("String::length()", str.length() == 22);

		str.reserve(32);
		assert("String::reserve()", str == "testing MAUtil::String" && str.length() == 22);
		assert("String::capacity()", str.capacity() == 32);

		str.clear();
		assert("String::clear()", str.length() == 0 && str == "");
	}
开发者ID:,项目名称:,代码行数:36,代码来源:

示例2:

/*
 * PublishingListener overwrite
 * FacebookPublisher2 registers itself as a PublishingListener of the mFacebook object. This will call the
 * FacebookPublisher2::publishingResponseReceived, sending the response from server in the "newId" param. The newId is
 * the id of new created object.
 * @param newId - the id of the new object.
 * @param path - contains the id of the object on which the publish request was made and the request name.
 * 				  e.g: id/feed, id/likes
 * This function is called when a new object is created (Album, Like, Comment, StatusMessage ect).
 */
void FacebookPublisher2::publishingResponseReceived(const MAUtil::String  &data, const MAUtil::String &path)
{
	MAUtil::String id;
	int found = data.find(":",0);
	if(found != MAUtil::String::npos)
	{
		found = data.find("\"", found);
		int last = data.findLastOf('"');
		if( (found != MAUtil::String::npos) && (last != MAUtil::String::npos))
		{
			id = data.substr(found+1, last-found);
		}

	}
	mListener->publishingResponseReceived(id, path);
}
开发者ID:AliSayed,项目名称:MoSync,代码行数:26,代码来源:FacebookPublisher2.cpp


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