#include "Utils.h" struct CharToUchar { WCHAR operator()(const char in) const { WCHAR result; mbstowcs(&result,&in,1); return result; } }; struct UcharToChar { char operator()(const WCHAR in) const { char result; wcstombs(&result,&in,1); return result; } }; UString toUString(int i) { TCHAR buffer[8]; return UString(_itow(i, buffer, 10)); } String toCString(int i) { char buffer[8]; return String(_itoa(i, buffer, 10)); } UString toUString(std::string s) { UString result(s.length(),L' '); std::transform(s.begin(), s.end(), result.begin(), CharToUchar()); return result; } std::string toCString(UString s) { std::string result(s.length(),' '); std::transform(s.begin(), s.end(), result.begin(), UcharToChar()); return result; } UString noMarkup(UString in) { bool inTag=false; UString::iterator pos; UString result; for(pos=in.begin();pos!=in.end();pos++) { if ((inTag)&&(*pos==L'>')) inTag=false; else if ((!inTag)&&(*pos==L'<')) inTag=true; else if (!inTag) result+=*pos; } return result; }