diff options
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 |