src/game/Utils/WordWrap.cc
ST::string CleanOutControlCodesFromString(const ST::utf32_buffer& codepoints)
{
	ST::string buf;
	const char32_t* s = codepoints.c_str();
	for (;;)
	{
		switch (*s)
		{
			case TEXT_CODE_CENTER:
			case TEXT_CODE_NEWCOLOR:
			case TEXT_CODE_BOLD:
			case TEXT_CODE_DEFCOLOR:
				++s;
				if (*s == TEXT_SPACE)
					++s;
				break;

			case TEXT_CODE_NEWLINE:
				++s;
				break;

			case U'\0':
				return buf;

			default:
				buf += *s++;
				break;
		}
	}
}
/* This procedure will run through a string and strip out all control
 * characters. This is a nessacary as wcscmp and the like tend not to like
 * control chars in their strings */
This procedure will run through a string and strip out all control
characters. This is a nessacary as wcscmp and the like tend not to like
control chars in their strings
This procedure will run through a string and strip out all control characters . This is a nessacary as wcscmp and the like tend not to like control chars in their strings
ST::string CleanOutControlCodesFromString(const ST::utf32_buffer& codepoints)
{
	ST::string buf;
	const char32_t* s = codepoints.c_str();
	for (;;)
	{
		switch (*s)
		{
			case TEXT_CODE_CENTER:
			case TEXT_CODE_NEWCOLOR:
			case TEXT_CODE_BOLD:
			case TEXT_CODE_DEFCOLOR:
				++s;
				if (*s == TEXT_SPACE)
					++s;
				break;
			case TEXT_CODE_NEWLINE:
				++s;
				break;
			case U'\0':
				return buf;
			default:
				buf += *s++;
				break;
		}
	}
}
ST :: string CleanOutControlCodesFromString ( const ST :: utf32_buffer & codepoints ) { ST :: string buf ; const char32_t * s = codepoints . c_str ( ) ; for ( ; ; ) { switch ( * s ) { case TEXT_CODE_CENTER : case TEXT_CODE_NEWCOLOR : case TEXT_CODE_BOLD : case TEXT_CODE_DEFCOLOR : ++ s ; if ( * s == TEXT_SPACE ) ++ s ; break ; case TEXT_CODE_NEWLINE : ++ s ; break ; case U' \0 ' : return buf ; default : buf += * s ++ ; break ; } } }
This procedure will run through a string and strip out all control
 characters.
This procedure will run through a string and strip out all control characters .