made a start with script functions

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@62 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2006-10-31 12:17:36 +00:00
parent 0caaf01a78
commit 1ffaa5bd58
20 changed files with 372 additions and 29 deletions
+10 -1
View File
@@ -123,7 +123,7 @@ String cannocial_name_form(const String& str) {
bool leading = true;
FOR_EACH_CONST(c, str) {
if ((c == _('_') || c == _(' ')) && !leading) {
ret += _('_');
ret += _(' ');
} else if (isAlnum(c)) {
ret += toLower(c);
leading = false;
@@ -195,3 +195,12 @@ bool is_substr(const String& str, size_t pos, const Char* cmp) {
}
return *cmp == _('\0');
}
bool cannocial_name_compare(const String& as, const Char* b) {
const Char* a = as.c_str();
while (true) {
if (*a != *b && !(*a == _(' ') && *b == _('_'))) return false;
if (*a == _('\0')) return true;
a++; b++;
}
}