Selaa lähdekoodia

git commit -a -m Improved Tool Display Name

CPKreuz 4 vuotta sitten
vanhempi
commit
a6d27d8c2b
1 muutettua tiedostoa jossa 27 lisäystä ja 0 poistoa
  1. 27 0
      PixiEditor/Helpers/Extensions/StringHelpers.cs

+ 27 - 0
PixiEditor/Helpers/Extensions/StringHelpers.cs

@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PixiEditor.Helpers.Extensions
+{
+    public static class StringHelpers
+    {
+        public static string AddSpacesBeforeUppercaseLetters(this string text)
+        {
+            if (string.IsNullOrWhiteSpace(text))
+                return "";
+
+            StringBuilder newText = new StringBuilder(text.Length * 2);
+            newText.Append(text[0]);
+            for (int i = 1; i < text.Length; i++)
+            {
+                if (char.IsUpper(text[i]) && text[i - 1] != ' ')
+                    newText.Append(' ');
+                newText.Append(text[i]);
+            }
+            return newText.ToString();
+        }
+    }
+}