simplified handling of punctuation is spellchecker, now checks for stand alone punctuation and double spaces.

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1275 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2008-12-31 03:11:25 +00:00
parent e36dc6e6cb
commit 311a743fa1
4 changed files with 84 additions and 48 deletions
+11 -4
View File
@@ -122,15 +122,22 @@ String strip_last_word(const String& s) {
}
}
const String word_start = String(_("[({\"\'")) + LEFT_SINGLE_QUOTE + LEFT_DOUBLE_QUOTE;
const String word_end = String(_("])}.,;:?!\"\'")) + RIGHT_SINGLE_QUOTE + RIGHT_DOUBLE_QUOTE;
const String word_start_chars = String(_("[({\"\'")) + LEFT_SINGLE_QUOTE + LEFT_DOUBLE_QUOTE;
const String word_end_chars = String(_("])}.,;:?!\"\'")) + RIGHT_SINGLE_QUOTE + RIGHT_DOUBLE_QUOTE;
void trim_punctuation(const String& str, size_t& start, size_t& end) {
start = str.find_first_not_of(word_start, start);
end = str.find_last_not_of(word_end, min(end,str.size()-1)) + 1;
start = str.find_first_not_of(word_start_chars, start);
end = str.find_last_not_of(word_end_chars, min(end,str.size()-1)) + 1;
if (start >= end) start = end;
}
bool is_word_start_punctuation(Char c) {
return word_start_chars.find_first_of(c) != String::npos;
}
bool is_word_end_punctuation(Char c) {
return word_end_chars.find_first_of(c) != String::npos;
}
// ----------------------------------------------------------------------------- : Caseing
/// Quick check to see if the substring starting at the given iterator is equal to some given string