From f68bb1864b40c69d12b44db5aa33125aef39e150 Mon Sep 17 00:00:00 2001 From: marcinzelent Date: Sat, 17 Mar 2018 15:33:00 +0100 Subject: Restructuring --- .../Utilities/StringUtilities.cs | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 DistributedPasswordCracker.Client/Utilities/StringUtilities.cs (limited to 'DistributedPasswordCracker.Client/Utilities/StringUtilities.cs') diff --git a/DistributedPasswordCracker.Client/Utilities/StringUtilities.cs b/DistributedPasswordCracker.Client/Utilities/StringUtilities.cs new file mode 100644 index 0000000..c29f99c --- /dev/null +++ b/DistributedPasswordCracker.Client/Utilities/StringUtilities.cs @@ -0,0 +1,42 @@ +using System; +using System.Linq; +using System.Text; + +namespace DistributedPasswordCracker.Client.Utilities +{ + class StringUtilities + { + public static String Capitalize(String str) + { + if (str == null) + { + throw new ArgumentNullException("str"); + } + if (str.Trim().Length == 0) + { + return str; + } + String firstLetterUppercase = str.Substring(0, 1).ToUpper(); + String theRest = str.Substring(1); + return firstLetterUppercase + theRest; + } + + public static String Reverse(String str) + { + if (str == null) + { + throw new ArgumentNullException("str"); + } + if (str.Trim().Length == 0) + { + return str; + } + StringBuilder reverseString = new StringBuilder(); + for (int i = 0; i < str.Length; i++) + { + reverseString.Append(str.ElementAt(str.Length - 1 - i)); + } + return reverseString.ToString(); + } + } +} \ No newline at end of file -- cgit v1.2.3