本文整理汇总了C++中ustring::erase方法的典型用法代码示例。如果您正苦于以下问题:C++ ustring::erase方法的具体用法?C++ ustring::erase怎么用?C++ ustring::erase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ustring
的用法示例。
在下文中一共展示了ustring::erase方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: bibleworks_clipboard_file_line_get_extract_book_id
unsigned int bibleworks_clipboard_file_line_get_extract_book_id (ustring& line)
// Gets the id of a book from a line of a BibleWorks database copied through the clipboard.
// The amount of text that make up the book is removed from the line.
// Normally a line of text would look like this:
// SCR Matthew 1:1 Βίβλος γενέσεως Ἰησοῦ Χριστοῦ, υἱοῦ Δαβὶδ, υἱοῦ Ἀβραάμ.
// or:
// SCR 1 Corinthians 1:1 Παῦλος κλητὸς ἀπόστολος Ἰησοῦ Χριστοῦ διὰ θελήματος Θεοῦ, καὶ Σωσθένης ὁ ἀδελφός,
{
// Remove whitespace from the start of the line.
while (line.substr (0, 1) == " ")
line.erase (0, 1);
// Remove the module abbreviation.
size_t pos = line.find (" ");
if (pos == string::npos)
return 0;
line.erase (0, ++pos);
// Get the name of the book.
vector <unsigned int> ids = books_type_to_ids (btUnknown);
for (unsigned int i = 0; i < ids.size(); i++) {
ustring english_name = books_id_to_english (ids[i]);
if (line.find (english_name) == 0) {
line.erase (0, english_name.length());
return ids[i];
}
}
return 0;
}
示例2: processAllMessages
/*
* Extracts and processes all messages inside the specified buffer.
* @throw CDCReading Exception
*/
void CDCImplPrivate::processAllMessages(ustring& msgBuffer) {
if (msgBuffer.empty()) {
return;
}
ParsedMessage parsedMessage = parseNextMessage(msgBuffer);
while ( parsedMessage.parseResult.resultType != PARSE_NOT_COMPLETE ) {
if ( parsedMessage.parseResult.resultType == PARSE_BAD_FORMAT ) {
// throw all bytes from the buffer up to next 0x0D
size_t endMsgPos = msgBuffer.find(0x0D, parsedMessage.parseResult.lastPosition);
if (endMsgPos == string::npos) {
msgBuffer.clear();
} else {
msgBuffer.erase(0, endMsgPos+1);
}
setLastReceptionError("Bad message format");
} else {
msgBuffer.erase(0, parsedMessage.parseResult.lastPosition+1);
processMessage(parsedMessage);
}
if (msgBuffer.empty()) {
return;
}
parsedMessage = parseNextMessage(msgBuffer);
}
}
示例3: trimLeft
ustring trimLeft( ustring &str, const ustring trimChars)
{
ustring::size_type pos = str.find_first_not_of( trimChars );
str.erase( 0, pos );
return str;
}
示例4: trimRight
ustring trimRight( ustring &str, ustring trimChars)
{
ustring::size_type pos = str.find_last_not_of( trimChars );
str.erase( pos + 1 );
return str;
}
示例5: de_byte_order_mark
void de_byte_order_mark (ustring& line)
// Some textfiles start with a byte order mark.
// This function remove it.
{
if (line.find ("") == 0) { // Note that there's text between the quotation marks.
line.erase (0, 1);
}
}
示例6: bitpattern_take
bool bitpattern_take(ustring & pattern)
// Return the next bit from "pattern" and removes it from that string.
// This implies that settngs from the pattern must be taken in the same order
// that they were added.
{
bool setting = false;
if (!pattern.empty()) {
setting = convert_to_bool(pattern.substr(0, 1));
pattern.erase(0, 1);
}
return setting;
}
示例7: convert_bibleworks_greek
ustring convert_bibleworks_greek (ustring line)
{
ustring outputline;
while (!line.empty()) {
ustring character;
bool converted = false;
// Convert the combined characters.
character = line.substr (0, 2);
for (unsigned int i = 0; i < sizeof(bibleworks_greek_table_2) / sizeof(*bibleworks_greek_table_2); i++) {
if (!converted) {
if (character == bibleworks_greek_table_2[i].input) {
outputline.append (bibleworks_greek_table_2[i].output);
line.erase (0, 2);
converted = true;
}
}
}
// Convert the single character.
if (!converted) {
character = line.substr (0, 1);
for (unsigned int i = 0; i < sizeof(bibleworks_greek_table_1) / sizeof(*bibleworks_greek_table_1); i++) {
if (!converted) {
if (character == bibleworks_greek_table_1[i].input) {
outputline.append (bibleworks_greek_table_1[i].output);
line.erase (0, 1);
converted = true;
}
}
}
}
// Message if the conversion didn't work out.
if (!converted) {
gw_critical ("Output so far: " + outputline + " - unhandled character: " + character + " - input stream: " + line);
outputline.append (character);
line.erase (0, 1);
}
}
return outputline;
}
示例8: clean_note
void NotesTransferDialog::clean_note(ustring & note)
// "Cleans" the note: removes unnecessary stuff.
{
ustring working_copy(note);
ustring marker = usfm_extract_marker(working_copy);
if (marker == "v") {
usfm_extract_marker(note);
note = trim(note);
ustring verse = number_in_string(note);
note.erase(0, verse.length());
note = trim(note);
}
}
示例9: 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);
}
示例10: bibleworks_define_parsing_gender
void bibleworks_define_parsing_gender (ustring& parsing, ustring& definition)
// Parse the gender.
{
ustring gender_code = parsing.substr (0, 1);
parsing.erase (0, 1);
if (gender_code == "m") {
definition.append (" masculine");
}
if (gender_code == "f") {
definition.append (" feminine");
}
if (gender_code == "n") {
definition.append (" neuter");
}
}
示例11: bibleworks_define_parsing_number
void bibleworks_define_parsing_number (ustring& parsing, ustring& definition)
// Parse the number.
{
ustring number = parsing.substr (0, 1);
bool remove_code = true;
if (number == "s") {
definition.append (" singular");
} else if (number == "p") {
definition.append (" plural");
} else {
remove_code = false;
}
if (remove_code) {
parsing.erase (0, 1);
}
}
示例12: 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);
}
}
示例13: bibleworks_define_parsing_tense
void bibleworks_define_parsing_tense (ustring& parsing, ustring& definition)
// Parse the tense of verbs.
{
ustring tense = parsing.substr (0, 1);
parsing.erase (0, 1);
if (tense == "p")
definition.append (" present");
if (tense == "i")
definition.append (" imperfect");
if (tense == "f")
definition.append (" future");
if (tense == "a")
definition.append (" aorist");
if (tense == "x")
definition.append (" perfect");
if (tense == "y")
definition.append (" pluperfect");
}
示例14: bibleworks_define_parsing_mood
void bibleworks_define_parsing_mood (ustring& parsing, ustring& definition)
// Parse the mood of verbs.
{
ustring mood = parsing.substr (0, 1);
parsing.erase (0, 1);
if (mood == "i")
definition.append (" indicative");
if (mood == "s")
definition.append (" subjunctive");
if (mood == "o")
definition.append (" optative");
if (mood == "d")
definition.append (" imperative");
if (mood == "n")
definition.append (" infinitive");
if (mood == "p")
definition.append (" participle");
}
示例15: bibleworks_define_parsing_person
void bibleworks_define_parsing_person (ustring& parsing, ustring& definition)
// This looks in the "parsing" whether the person is given.
// If so, it adds the description to the "definition" and removes the relevant code from the "parsing".
{
ustring person = parsing.substr (0, 1);
bool person_found = true;
if (person == "1") {
definition.append (" first person");
} else if (person == "2") {
definition.append (" second person");
} else if (person == "3") {
definition.append (" third person");
} else {
person_found = false;
}
if (person_found) {
parsing.erase (0, 1);
}
}