bool EqualsASCII(const string16& a, const base::StringPiece& b) { if(a.length() != b.length()) { return false; } return std::equal(b.begin(), b.end(), a.begin()); }
string16 ASCIIToUTF16(const base::StringPiece& ascii) { DCHECK(IsStringASCII(ascii)) << ascii; return string16(ascii.begin(), ascii.end()); }
std::wstring ASCIIToWide(const base::StringPiece& ascii) { DCHECK(IsStringASCII(ascii)) << ascii; return std::wstring(ascii.begin(), ascii.end()); }