Пример #1
0
	/*************************************************************************
	Trim all characters from the set specified in \a chars from the
	begining of 'str'.	
	*************************************************************************/
	void TextUtils::trimLeadingChars(String32& str, const String32& chars)
	{
		String32::size_type idx = str.find_first_not_of(chars);

		if (idx != String32::npos)
		{
			str.erase(0, idx);
		}
		else
		{
			str.erase();
		}

	}
Пример #2
0
	/*************************************************************************
	Trim all characters from the set specified in \a chars from the end
	of 'str'.	
	*************************************************************************/
	void TextUtils::trimTrailingChars(String32& str, const String32& chars)
	{
		String32::size_type idx = str.find_last_not_of(chars);

		if (idx != String32::npos)
		{
			str.resize(idx + 1);
		}
		else
		{
			str.erase();
		}

	}