diff options
author | marcinzelent <zelent.marcin@gmail.com> | 2018-03-17 15:33:00 +0100 |
---|---|---|
committer | marcinzelent <zelent.marcin@gmail.com> | 2018-03-17 15:33:00 +0100 |
commit | f68bb1864b40c69d12b44db5aa33125aef39e150 (patch) | |
tree | bb11f3714a2aa99708f5cca2feec3ff68d3e5b88 /DistributedPasswordCracker.Client/Utilities/StringUtilities.cs | |
parent | 7e2a8dbd051b94115672cf22cc66ef09ba8376ca (diff) |
Restructuring
Diffstat (limited to 'DistributedPasswordCracker.Client/Utilities/StringUtilities.cs')
-rw-r--r-- | DistributedPasswordCracker.Client/Utilities/StringUtilities.cs | 42 |
1 files changed, 42 insertions, 0 deletions
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 |