aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Core/ExtensionMethods
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-03-18 12:54:12 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-03-18 12:54:12 +0200
commitfd2641e5aa4e915cc133310bd87d21278b84e50b (patch)
tree8ec40d665967281db7617d0b8a0cc785913a32ed /Software/Visual_Studio/Tango.Core/ExtensionMethods
parent2836f1031bf9c1414a80620e040c1414a45c1648 (diff)
downloadTango-fd2641e5aa4e915cc133310bd87d21278b84e50b.tar.gz
Tango-fd2641e5aa4e915cc133310bd87d21278b84e50b.zip
Working on machine events !
Diffstat (limited to 'Software/Visual_Studio/Tango.Core/ExtensionMethods')
-rw-r--r--Software/Visual_Studio/Tango.Core/ExtensionMethods/StringExtensions.cs18
1 files changed, 18 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Tango.Core/ExtensionMethods/StringExtensions.cs b/Software/Visual_Studio/Tango.Core/ExtensionMethods/StringExtensions.cs
index e31456871..a291ff389 100644
--- a/Software/Visual_Studio/Tango.Core/ExtensionMethods/StringExtensions.cs
+++ b/Software/Visual_Studio/Tango.Core/ExtensionMethods/StringExtensions.cs
@@ -108,4 +108,22 @@ public static class StringExtensions
{
return text.Length <= maxLength ? text : text.Substring(0, maxLength) + "...";
}
+
+ /// <summary>
+ /// Splits the camel case sentence to words.
+ /// </summary>
+ /// <param name="str">The string.</param>
+ /// <returns></returns>
+ public static string ToWords(this string str)
+ {
+ return Regex.Replace(
+ Regex.Replace(
+ str,
+ @"(\P{Ll})(\P{Ll}\p{Ll})",
+ "$1 $2"
+ ),
+ @"(\p{Ll})(\P{Ll})",
+ "$1 $2"
+ );
+ }
}