本文整理汇总了C++中ustring::find_first_of方法的典型用法代码示例。如果您正苦于以下问题:C++ ustring::find_first_of方法的具体用法?C++ ustring::find_first_of怎么用?C++ ustring::find_first_of使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ustring
的用法示例。
在下文中一共展示了ustring::find_first_of方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Query
void Query(ServerConnection *conn, const ustring& params)
{
ustring::size_type pos1 = params.find_first_of(" ");
ustring nick = params.substr(0, pos1);
if (nick.empty()) {
throw CommandException(_("/QUERY <nick>, start a query(tab) with a user"));
} else {
AppWin->getNotebook().addTab(Tab::QUERY, nick, conn);
}
}
示例2: split
static void split(std::vector<ustring>& strvec, const ustring& str) {
size_t start = 0, np = ustring::npos;
while (true) {
size_t end = str.find_first_of(' ', start);
size_t len = (end == np) ? np : end - start;
if (len > 0) {
strvec.push_back(str.substr(start, len).lowercase());
}
if (end == np) {
return;
}
start = end + 1;
}
}
示例3: clear_out_any_marker
void CategorizeLine::clear_out_any_marker(ustring & line)
{
size_t startpos = 0;
startpos = line.find("\\", startpos);
while (startpos != string::npos) {
ustring marker;
size_t endpos = line.find_first_of(" *", startpos);
if (endpos == string::npos) {
marker = line.substr(startpos + 1, line.length() - startpos);
} else {
marker = line.substr(startpos + 1, endpos - startpos - 1);
}
line.erase(startpos, marker.length() + 2);
startpos++;
startpos = line.find("\\", startpos);
}
}
示例4: usfm_extract_marker_with_forwardslash
ustring CheckValidateUsfm::usfm_extract_marker_with_forwardslash(ustring & line)
// Returns the usfm marker from the line, but only if it starts with a forward slash
{
ustring returnvalue;
line = trim(line);
size_t offposition;
offposition = line.find("/");
if (offposition != string::npos) {
line.erase(0, offposition);
size_t endposition;
endposition = line.find_first_of(" *", 1);
if (endposition != string::npos) {
returnvalue = line.substr(0, ++endposition);
line.erase(0, endposition);
} else {
returnvalue = line;
line.clear();
}
}
if (returnvalue.length() > 0)
returnvalue.erase(0, 1); // Remove slash.
return trim(returnvalue);
}