Exemplo n.º 1
0
 public static bool operator >=(BString A, BString B)
 {
     return(BString.CompareStrict(A, B) >= 0);
 }
Exemplo n.º 2
0
 public void AppendLine(BString Value)
 {
     this.Append(Value);
     this.AppendLine();
 }
Exemplo n.º 3
0
 public override int GetHashCode()
 {
     return(BString.GetHashCode(this));
 }
Exemplo n.º 4
0
 // Opperators //
 public static BString operator +(BString A, BString B)
 {
     return(BString.Concat(A, B));
 }
Exemplo n.º 5
0
 public BString Remove(BString Old)
 {
     return(this.Replace(Old, BString.Empty, 0));
 }
Exemplo n.º 6
0
 public BString Remove(BString Old, int StartAt)
 {
     return(this.Replace(Old, BString.Empty, StartAt));
 }
Exemplo n.º 7
0
 public BString Replace(BString Old, BString New)
 {
     return(this.Replace(Old, New, 0));
 }
Exemplo n.º 8
0
 public int Find(BString Value)
 {
     return(this.Find(Value, 0));
 }
Exemplo n.º 9
0
        public BString[] Split(byte[] Delim, byte Escape, bool KeepDelims)
        {
            if (Delim.Contains(Escape))
            {
                throw new Exception("The deliminators cannot contain the escape token");
            }

            List <BString> TempArray = new List <BString>();
            BStringBuilder sb        = new BStringBuilder();
            bool           InEscape  = false;

            // Go through each char in string //
            foreach (byte b in this._elements)
            {
                // turn on escaping //
                if (b == Escape)
                {
                    InEscape = (!InEscape);
                }

                // Slipt //
                if (!InEscape)
                {
                    // We found a deliminator //
                    if (Delim.Contains(b))
                    {
                        BString s = sb.ToBString();

                        // Check the size of the current cache and add the string, which would happend if we had 'A,B,,C,D' //
                        if (s.Length == 0)
                        {
                            TempArray.Add(null);
                        }
                        else
                        {
                            TempArray.Add(s);
                        }

                        // Check to see if we need to keep our delims //
                        if (KeepDelims)
                        {
                            TempArray.Add(new BString(b));
                        }

                        sb = new BStringBuilder();
                    }
                    else if (b != Escape)
                    {
                        sb.Append(b);
                    }
                }// end the string building phase //
                else if (b != Escape)
                {
                    sb.Append(b);
                }
            }

            if (InEscape)
            {
                throw new ArgumentOutOfRangeException("Unclosed escape sequence");
            }

            // Now do clean up //
            BString t = sb.ToBString();

            // The string has some AWValue //
            if (t.Length != 0)
            {
                // Check that we didn't end on a delim AWValue, but if we did and we want delims, then keep it //
                if (!(t.Length == 1 && Delim.Contains(t[0])) || KeepDelims)
                {
                    TempArray.Add(sb.ToBString());
                }
            }
            // Check if we end on a delim, such as A,B,C,D, where ',' is a delim; we want our array to be {A , B , C , D , null}
            else if (Delim.Contains(this._elements.Last()))
            {
                TempArray.Add(null);
            }
            return(TempArray.ToArray());
        }