Browse Source

Change definition of Acedia's "name"

pull/8/head
Anton Tarasenko 2 years ago
parent
commit
cd4163bf9c
  1. 16
      sources/Text/BaseText.uc

16
sources/Text/BaseText.uc

@ -409,9 +409,8 @@ public final function MutableText UpperMutableCopy(
*
* Valid names are case-insensitive `BaseText`s that:
* 1. No longer than 50 characters long;
* 2. Contain only ASCII characters, digits and '.' / '_' characters;
* 3. Has to start with a latin letter or '_';
* 4. Empty `BaseText` is not considered a valid name.
* 2. Contain only ASCII letters, digits and '.' / '_' characters;
* 3. Empty `BaseText` is not considered a valid name.
*
* @return `true` if caller `BaseText` contains a valid config object name and
* `false` otherwise.
@ -426,16 +425,7 @@ public final function bool IsValidName()
if (IsEmpty()) return false;
if (GetLength() > 50) return false;
// Test first character separately, since it cannot be digit
nextCharacter = GetCharacter(0);
codePoint = nextCharacter.codePoint;
isValidCodePoint = ( codePoint == 0x5F // '_'
|| (0x41 <= codePoint && codePoint <= 0x5A) // 'A' to 'Z'
|| (0x61 <= codePoint && codePoint <= 0x7A)); // 'a' to 'z'
if (!isValidCodePoint) {
return false;
}
for (i = 1; i < GetLength(); i += 1)
for (i = 0; i < GetLength(); i += 1)
{
nextCharacter = GetCharacter(i);
codePoint = nextCharacter.codePoint;

Loading…
Cancel
Save