Example #1
0
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());
}
Example #2
0
bool MatchPattern(const base::StringPiece& eval,
                  const base::StringPiece& pattern)
{
    return MatchPatternT(eval.data(), eval.data()+eval.size(),
        pattern.data(), pattern.data()+pattern.size(),
        0, NextCharUTF8());
}
Example #3
0
	bool TrimString(const std::string& input,
		const base::StringPiece& trim_chars,
		std::string* output) {
		return TrimStringT(input, trim_chars.as_string(), TRIM_ALL, output) !=
			TRIM_NONE;
	}
Example #4
0
	bool RemoveChars(const std::string& input,
		const base::StringPiece& remove_chars,
		std::string* output) {
		return ReplaceChars(input, remove_chars.as_string(), std::string(), output);
	}
Example #5
0
	bool ReplaceChars(const std::string& input,
		const base::StringPiece& replace_chars,
		const std::string& replace_with,
		std::string* output) {
		return ReplaceCharsT(input, replace_chars.as_string(), replace_with, output);
	}
std::wstring UTF8ToWide(const base::StringPiece& utf8)
{
    std::wstring ret;
    UTF8ToWide(utf8.data(), utf8.length(), &ret);
    return ret;
}
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());
}