本文整理汇总了C++中gkString::size方法的典型用法代码示例。如果您正苦于以下问题:C++ gkString::size方法的具体用法?C++ gkString::size怎么用?C++ gkString::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gkString
的用法示例。
在下文中一共展示了gkString::size方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getTok
bool getTok(const gkString& buf, const gkString& dim, gkString& tok, size_t &start)
{
const size_t size = buf.size();
const size_t dimsize = dim.size();
size_t pos = gkString::npos;
while (start < size)
{
pos = buf.find(dim, start);
if (pos == gkString::npos)
pos = size;
if (start == pos)
start += dimsize;
else
break;
}
if (start >= size) return false;
tok.assign(&buf[start], pos-start);
start = pos + dimsize;
return true;
}
示例2: getTextBom
BOM getTextBom(gkString& line, bool removeBom)
{
size_t len = line.size();
BOM bom = getTextEncoding(line.c_str(), len);
if (bom != BOM_NONE && removeBom) {
//strip bom
line = line.substr(getBOMLength(bom));
}
return bom;
}
示例3: splitFileName
void splitFileName(const gkString& path, gkString& dir, gkString& base, gkString& ext)
{
if (path.empty()) return;
if (path == "." || path == "..")
{
dir = path;
return;
}
gkString fpath = path, fname;
char delim = '/';
bool bdelim = fpath.find_last_of('\\') != gkString::npos;
bool fdelim = fpath.find_last_of('/') != gkString::npos;
if (bdelim)
{
if (fdelim) //normalize to \ to /
std::replace(fpath.begin(), fpath.end(), '\\', '/');
else
delim = '\\';
}
size_t i = fpath.find_last_of(delim);
if (i != gkString::npos)
{
dir = fpath.substr(0, i);
fname = fpath.substr(i+1, path.size()-1);
}
else
{
dir.clear();
fname = fpath;
}
i = fname.find_last_of('.');
if (i != gkString::npos)
{
base = fname.substr(0, i);
ext = fname.substr(i+1, fname.size()-1);
}
else
{
base = fname;
ext.clear();
}
}