Пример #1
0
 public BITSTRING(string s_)
 {
     if (VerifyString(s_) == 0)
     {
         Console.WriteLine("Введенная строка некорректна!");
         str    = "";
         length = new word(0);
     }
     else
     {
         int  id   = 1;
         int  len  = 16;
         char sign = '+';
         if (s_[0] == '-')
         {
             sign = '-';
         }
         else
         {
             id = 0;
         }
         while (s_[id] == '0' && id < s_.Length)
         {
             id++;
         }
         s_  = s_.Substring(id);
         len = s_.Length;
         while (len % 4 > 0)
         {
             len++;
         }
         while (s_.Length < len)
         {
             s_ = (char)'0' + s_;
         }
         if (sign == '+')
         {
             s_ = "0," + s_;
         }
         else
         {
             s_ = "1," + s_;
         }
         str    = s_;
         length = new word(str.Length);
     }
 }
Пример #2
0
 // Ìåòîä î÷èùàþùèé ñòðîêó.
 public void Clear()
 {
     str    = "";
     length = new word(0);
 }
Пример #3
0
 // êîíñòðóêòîð, ïðèíèìàþùèé â êà÷åñòâå ïàðàìåòðà ñèìâîë;
 public STRING(char ch)
 {
     str    = Convert.ToString(ch);
     length = new word(1);
 }
Пример #4
0
 // êîíñòðóêòîð, ïðèíèìàþùèé â êà÷åñòâå ïàðàìåòðà ñòðîêîâûé ëèòåðàë
 public STRING(string str)
 {
     this.str = str;
     length   = new word(str.Length);
 }
Пример #5
0
 public BITSTRING()
 {
     str    = "";
     length = new word(0);
 }