summary refs log tree commit diff
path: root/crypto/src/util/Strings.cs
diff options
context:
space:
mode:
authorMegan Woods <megan@flygfisk.com>2019-01-14 17:07:22 +1100
committerMegan Woods <megan@flygfisk.com>2019-01-14 17:07:22 +1100
commitecc8edb622f0f42d43f72ae388fa4c4274e51c5f (patch)
tree9091e5bf1fe54dde31ee786956139b0fb54b0ba3 /crypto/src/util/Strings.cs
parentminor tweaks (diff)
downloadBouncyCastle.NET-ed25519-ecc8edb622f0f42d43f72ae388fa4c4274e51c5f.tar.xz
Initial CMP
Diffstat (limited to 'crypto/src/util/Strings.cs')
-rw-r--r--crypto/src/util/Strings.cs25
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)