mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
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:
+10
-1
@@ -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++;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user