示例#1
0
static SimpleString addMarkerToString(const SimpleString& str, int markerPos)
{
	size_t bufferSize = str.size()+1;
	char* buffer = (char*) PlatformSpecificMalloc(bufferSize);
	str.copyToBuffer(buffer, bufferSize);

	buffer[markerPos] = '^';

	SimpleString result(buffer);
	PlatformSpecificFree(buffer);
	return result;

}
示例#2
0
static SimpleString removeAllPrintableCharactersFrom(const SimpleString& str)
{
	size_t bufferSize = str.size()+1;
	char* buffer = (char*) PlatformSpecificMalloc(bufferSize);
	str.copyToBuffer(buffer, bufferSize);

	for (size_t i = 0; i < bufferSize-1; i++)
		if (buffer[i] != '\t' && buffer[i] != '\n')
			buffer[i] = ' ';

	SimpleString result(buffer);
	PlatformSpecificFree(buffer);
	return result;
}