Example #1
0
 public BString ToUpper()
 {
     byte[] b = new byte[this.Length];
     for (int i = 0; i < this.Length; i++)
     {
         b[i] = BStringEncoding.ToUpper(this._elements[i]);
     }
     return(new BString(b));
 }
Example #2
0
        public static int GetHashCodeIgnoreCase(BString A)
        {
            if (object.ReferenceEquals(A, null))
            {
                return(0);
            }

            int hash = 0;

            foreach (byte b in A.ToByteArray)
            {
                hash += ((int)BStringEncoding.ToUpper(b)) * 127 % 17;
            }

            return(hash);
        }
Example #3
0
        public static int CompareWeakIgnoreCase(BString A, BString B)
        {
            if (object.ReferenceEquals(A, null) || object.ReferenceEquals(B, null))
            {
                return(-1);
            }

            for (int i = 0; i < Math.Min(A.Length, B.Length); i++)
            {
                if (A[i] != B[i])
                {
                    return(BStringEncoding.ToLower(A[i]) < BStringEncoding.ToLower(B[i]) ? -1 : 1);
                }
            }

            return(0);
        }
Example #4
0
 public void AppendLine(string Value)
 {
     this.Append(BStringEncoding.StringToBytes(Value));
     this.AppendLine();
 }
Example #5
0
 public void Append(char Value)
 {
     this._Values.Add(BStringEncoding.CharToByte(Value));
 }
Example #6
0
 public BString(string Text)
     : this(BStringEncoding.StringToBytes(Text ?? ""))
 {
 }
Example #7
0
 // Overrides //
 public override string ToString()
 {
     return(BStringEncoding.BytesToString(this._elements));
 }