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


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

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


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

示例1: EscapeHelper

/**
 * Helper function that escapes a string.
 */
static MAUtil::String EscapeHelper(const MAUtil::String& str)
{
	// The encoded string.
	MAUtil::String result = "";
    char buf[8];

    for (int i = 0; i < str.length(); ++i)
    {
    	char c = str[i];
        if ((48 <= c && c <= 57) ||  // 0-9
            (65 <= c && c <= 90) ||  // a..z
            (97 <= c && c <= 122))   // A..Z
        {
        	result.append(&str[i], 1);
        }
        else
        {
        	result += "%";
            sprintf(buf, "%02X", str[i]);
            result += buf;
        }
    }

    return result;
}
开发者ID:donggx,项目名称:mobilelua,代码行数:28,代码来源:LuaEngine.cpp

示例2: getPropertyString

/**
	 * Widget override.
	 * Get a widget property as a string, setting also the result code.
	 */
MAUtil::String FacebookWebView::getPropertyString( const MAUtil::String& property ) const
{
	char *buffer = new char[BUFFER_SIZE];

	int result = maWidgetGetProperty(this->getWidgetHandle(), property.c_str(), buffer, BUFFER_SIZE);

	MAUtil::String temp;

	if( result == MAW_RES_INVALID_STRING_BUFFER_SIZE)
	{
		delete []buffer;
		int newBufferSize = 2*BUFFER_SIZE;
		buffer = new char[newBufferSize];
		result = maWidgetGetProperty(this->getWidgetHandle(), property.c_str(), buffer, newBufferSize);
	}

	if( result == RES_OK)
	{
		temp.append(buffer, BUFFER_SIZE);
	}

	delete []buffer;
	return temp;
}
开发者ID:Felard,项目名称:MoSync,代码行数:28,代码来源:FacebookWebView.cpp

示例3: _readSettings

	/**
	 * \brief This function is used for reading the settings from the settings file
	 */
	void SettingsManager::_readSettings()
	{
		char settingsFileContent[Model::BUFF_SIZE];
		MAUtil::String content;

		int fileSize = maFileSize(_settingsFile);

		maFileRead(_settingsFile, settingsFileContent, fileSize);

		content.append(settingsFileContent, strlen(settingsFileContent));

		int offset = 0;
		int position = content.find("|", offset);
		_coin = content.substr(offset, position); //read the coin

		offset = position + 1;
		position = content.find("|", offset);

		int day = MAUtil::stringToInteger(content.substr(offset, position - offset), 10); //read the reset day

		offset = position + 1;
		position = content.find("|", offset);

		MAUtil::String dateString = content.substr(offset, position - offset); //read the dateString

		offset = position + 1;
		position = content.find("|", offset);

		MAUtil::String binaryMask = content.substr(offset, position - offset); //read the binary mask
		offset = position + 1;
		_debtValue = MAUtil::stringToDouble(content.substr(offset, content.length() - offset));

		if(binaryMask ==  "100")
		{
			_showAll = true;
			_showMonthly = false;
			_showFromDate = false;
		}
		else if(binaryMask == "010")
		{
			_showAll = false;
			_showMonthly = true;
			_showFromDate = false;
		}
		else if(binaryMask == "001")
		{
			_showAll = false;
			_showMonthly = false;
			_showFromDate = true;
		}

		if(_showMonthly)
		{
			_date._day = day;

			struct tm * dateTime = new tm;
			split_time(maTime(), dateTime);

			_date._mounth = dateTime->tm_mon + 1;
			_date._year = dateTime->tm_year + 1900;

			delete dateTime;
		}
		else if(_showFromDate)
		{
			offset = 0;
			position = dateString.find("-", offset);

			_date._year = MAUtil::stringToInteger(dateString.substr(offset, position), 10);

			offset = position + 1;
			position = dateString.find("-", offset);

			_date._mounth = MAUtil::stringToInteger(dateString.substr(offset, position - offset), 10);

			offset = position + 1;
			_date._day = MAUtil::stringToInteger(dateString.substr(offset, dateString.length() - offset), 10);
		}
		else if(_showAll)
		{
			_date._day = 1;
			_date._mounth = 1;
			_date._year = 1601;
		}
	}
开发者ID:ciprif,项目名称:MyBudget-App,代码行数:88,代码来源:settingsManager.cpp


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