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); } }
// Ìåòîä î÷èùàþùèé ñòðîêó. public void Clear() { str = ""; length = new word(0); }
// êîíñòðóêòîð, ïðèíèìàþùèé â êà÷åñòâå ïàðàìåòðà ñèìâîë; public STRING(char ch) { str = Convert.ToString(ch); length = new word(1); }
// êîíñòðóêòîð, ïðèíèìàþùèé â êà÷åñòâå ïàðàìåòðà ñòðîêîâûé ëèòåðàë public STRING(string str) { this.str = str; length = new word(str.Length); }
public BITSTRING() { str = ""; length = new word(0); }