Additional rules for BeautifyClassName().

This commit is contained in:
Mari the Deer 2024-01-22 18:35:54 +01:00
commit 891b69d3da
2 changed files with 13 additions and 3 deletions

View file

@ -127,7 +127,7 @@ extend Class SWWMUtility
str.AppendCharacter(cp1);
if ( i < len-1 )
{
int cp2 = workstr.GetNextCodePoint(pos);
let [cp2, pos2] = workstr.GetNextCodePoint(pos);
// this looks awkward, but I have to also account for non-letter characters
// uppercase after lowercase
if ( (String.CharUpper(cp1) != cp1) && (String.CharLower(cp2) != cp2) )
@ -135,9 +135,19 @@ extend Class SWWMUtility
// uppercase after non-letter
else if ( (String.CharUpper(cp1) == cp1) && (String.CharLower(cp1) == cp1) && (String.CharLower(cp2) != cp2) )
str.AppendCharacter(0x20);
// lowercase after non-letter
if ( (String.CharUpper(cp1) == cp1) && (String.CharLower(cp1) == cp1) && (String.CharUpper(cp2) != cp2) )
str.AppendCharacter(0x20);
// non-letter after lowercase
else if ( (String.CharUpper(cp1) != cp1) && (String.CharLower(cp2) == cp2) && (String.CharUpper(cp2) == cp2) )
str.AppendCharacter(0x20);
if ( i < len-2 )
{
let [cp3, pos3] = workstr.GetNextCodePoint(pos2);
// uppercase before uppercase before lowercase
if ( (String.CharLower(cp1) != cp1) && (String.CharLower(cp2) != cp2) && (String.CharUpper(cp3) != cp3) )
str.AppendCharacter(0x20);
}
}
}
}