本文整理汇总了C++中wtf::String::remove方法的典型用法代码示例。如果您正苦于以下问题:C++ String::remove方法的具体用法?C++ String::remove怎么用?C++ String::remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wtf::String
的用法示例。
在下文中一共展示了String::remove方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: resolveMimeType
const string WebResponse::resolveMimeType(const string& url, const string& old_mime)
{
// Use "text/html" as a default (matching the behaviour of the Apache
// HTTP stack -- see guessMimeType() in LoadListener.java).
string mimeType = old_mime.length() ? old_mime : "text/html";
// Try to guess a better MIME type from the URL. We call
// getMIMETypeForExtension rather than getMIMETypeForPath because the
// latter defaults to "application/octet-stream" on failure.
WebCore::KURL kurl(WebCore::ParsedURLString, url.c_str());
WTF::String path = kurl.path();
size_t extensionPos = path.reverseFind('.');
if (extensionPos != WTF::notFound) {
// We found a file extension.
path.remove(0, extensionPos + 1);
// TODO: Should use content-disposition instead of url if it is there
WTF::String mime = WebCore::MIMETypeRegistry::getMIMETypeForExtension(path);
if (!mime.isEmpty()) {
// Great, we found a MIME type.
mimeType = std::string(mime.utf8().data(), mime.length());
}
}
return mimeType;
}