diff options
Diffstat (limited to 'crypto/src/util')
-rw-r--r-- | crypto/src/util/Strings.cs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/crypto/src/util/Strings.cs b/crypto/src/util/Strings.cs index 3937a087f..73a15ea73 100644 --- a/crypto/src/util/Strings.cs +++ b/crypto/src/util/Strings.cs @@ -6,6 +6,31 @@ namespace Org.BouncyCastle.Utilities /// <summary> General string utilities.</summary> public abstract class Strings { + + public static string ToUpperCase(string original) + { + bool changed = false; + char[] chars = original.ToCharArray(); + + for (int i = 0; i != chars.Length; i++) + { + char ch = chars[i]; + if ('a' <= ch && 'z' >= ch) + { + changed = true; + chars[i] = (char)(ch - 'a' + 'A'); + } + } + + if (changed) + { + return new String(chars); + } + + return original; + } + + internal static bool IsOneOf(string s, params string[] candidates) { foreach (string candidate in candidates) |