Merge branch 'Tryibion-first-capital-letter-fix'
This commit is contained in:
@@ -906,12 +906,21 @@ namespace FlaxEditor.Utilities
|
||||
if (name.StartsWith("g_") || name.StartsWith("m_"))
|
||||
startIndex = 2;
|
||||
|
||||
if (name.StartsWith("_"))
|
||||
startIndex = 1;
|
||||
|
||||
// Filter text
|
||||
var lastChar = '\0';
|
||||
for (int i = startIndex; i < length; i++)
|
||||
{
|
||||
var c = name[i];
|
||||
|
||||
if (i == startIndex)
|
||||
{
|
||||
sb.Append(char.ToUpper(c));
|
||||
continue;
|
||||
}
|
||||
|
||||
// Space before word starting with uppercase letter
|
||||
if (char.IsUpper(c) && i > 0)
|
||||
{
|
||||
|
||||
@@ -11,10 +11,10 @@ namespace FlaxEditor.Tests
|
||||
[Test]
|
||||
public void TestFormatting()
|
||||
{
|
||||
Assert.AreEqual("property", Utils.GetPropertyNameUI("property"));
|
||||
Assert.AreEqual("property", Utils.GetPropertyNameUI("_property"));
|
||||
Assert.AreEqual("property", Utils.GetPropertyNameUI("m_property"));
|
||||
Assert.AreEqual("property", Utils.GetPropertyNameUI("g_property"));
|
||||
Assert.AreEqual("Property", Utils.GetPropertyNameUI("property"));
|
||||
Assert.AreEqual("Property", Utils.GetPropertyNameUI("_property"));
|
||||
Assert.AreEqual("Property", Utils.GetPropertyNameUI("m_property"));
|
||||
Assert.AreEqual("Property", Utils.GetPropertyNameUI("g_property"));
|
||||
Assert.AreEqual("Property", Utils.GetPropertyNameUI("Property"));
|
||||
Assert.AreEqual("Property 1", Utils.GetPropertyNameUI("Property1"));
|
||||
Assert.AreEqual("Property Name", Utils.GetPropertyNameUI("PropertyName"));
|
||||
|
||||
Reference in New Issue
Block a user