/// <summary> /// Ises the quantifier. /// </summary> /// <returns> /// The quantifier. /// </returns> /// <param name='_value'> /// If set to <c>true</c> _value. /// </param> public static bool isQuantifier(System.Char _value) { string pattern = @"[\+\.\*\?]"; Regex rgx = new Regex(pattern); return(rgx.IsMatch(_value.ToString())); }
public AlphabetSection(Char letter, IEnumerable<Member> members) { Letter = letter.ToString().ToUpper(); Members = members.Where(m => m.Handle.StartsWith(Letter, StringComparison.OrdinalIgnoreCase)) .OrderBy(m => m.Handle) .ToList(); }
public Char xor(Char a, Char b) { if(String.Compare(a.ToString(),b.ToString(),true)==0){ return '0'; } return '1'; }
/// <summary> /// Ises the char. /// </summary> /// <returns> /// The char. /// </returns> /// <param name='_value'> /// If set to <c>true</c> _value. /// </param> public static bool isChar(System.Char _value) { string pattern = @"[\n\r]"; Regex rgx = new Regex(pattern); return(!rgx.IsMatch(_value.ToString())); }
public static bool isLiteral(System.Char _value) { string pattern = @"[\wa-zA-Z0-9:/]"; Regex rgx = new Regex(pattern); return(rgx.IsMatch(_value.ToString())); }
internal static System.String Decode(System.String entity) { if (entity[entity.Length - 1] == ';') { // remove trailing semicolon entity = entity.Substring(0, (entity.Length - 1) - (0)); } if (entity[1] == '#') { int start = 2; int radix = 10; if (entity[2] == 'X' || entity[2] == 'x') { start++; radix = 16; } System.Char c = (char)System.Convert.ToInt32(entity.Substring(start), radix); return(c.ToString()); } else { System.String s = (System.String)decoder[entity]; if (s != null) { return(s); } else { return(""); } } }
public String applyRule(Char inCharater) { foreach (Rule rule in ruleList) { if (rule.getPredecessor() == inCharater.ToString()) return rule.getSuccessor(); } return ""; }
static StackObject *ToString_0(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Char instance_of_this_method = GetInstance(__domain, ptr_of_this_method, __mStack); var result_of_this_method = instance_of_this_method.ToString(); return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method)); }
public static String[] Split(String source, Char separator) { var items = source.Split(separator); var itemCount = 0; if (source.EndsWith(separator.ToString())) itemCount = items.Length - 1; else itemCount = items.Length; String[] result = new String[itemCount]; Array.Copy(items, result, result.Length); return result; }
public static string FormatName(string name, Char prefixToRemove, string suffixToAppend) { StringBuilder sb = new StringBuilder(); if (name.StartsWith(prefixToRemove.ToString()) && Char.IsUpper(name[1])) { sb.Append(name.Substring(1)); } else { sb.Append(name); } sb.Append(suffixToAppend); return sb.ToString(); }
public void Add(Char CurChar) { if (this.Count() < 1) { this.Elements.Add("0"); } if (CurChar == ';') { this.Elements.Add("0"); } else { int i = this.Elements.Count - 1; this.Elements[i] = ((String) this.Elements[i] + CurChar.ToString()); } }
private Point GetDrawStringOffset(Graphics CurGraphics, Int32 X, Int32 Y, Char CurChar) { // DrawString doesn't actually print where you tell it to but instead consistently prints // with an offset. This is annoying when the other draw commands do not print with an offset // this method returns a point defining the offset so we can take it off the printstring command. CharacterRange[] characterRanges = {new CharacterRange(0, 1)}; RectangleF layoutRect = new RectangleF(X, Y, 100, 100); StringFormat stringFormat = new StringFormat(); stringFormat.SetMeasurableCharacterRanges(characterRanges); Region[] stringRegions = new Region[1]; stringRegions = CurGraphics.MeasureCharacterRanges( CurChar.ToString(), this.Font, layoutRect, stringFormat); RectangleF measureRect1 = stringRegions[0].GetBounds(CurGraphics); return new Point((Int32) (measureRect1.X + 0.5), (Int32) (measureRect1.Y + 0.5)); }
private void FirstCharSearch(Char value) { if (value == ' ') return; _searchString = value.ToString(); TreeNodeAdv node = null; if (_tree.SelectedNode != null) node = _tree.SelectedNode.NextVisibleNode; if (node == null) node = _tree.Root; foreach (string label in IterateNodeLabels(node)) { if (label.StartsWith(_searchString)) { _tree.SelectedNode = _currentNode; return; } } }
public void Search(Char value) { if (!Char.IsControl(value)) { Char ch = Char.ToLowerInvariant(value); DateTime dt = DateTime.Now; TimeSpan ts = dt - _lastKeyPressed; _lastKeyPressed = dt; if (ts.TotalMilliseconds < SearchTimeout) { if (_searchString == value.ToString()) FirstCharSearch(ch); else ContinuousSearch(ch); } else { FirstCharSearch(ch); } } }
public string ToDotGraph() { var builder = new StringBuilder(); builder.AppendLine("digraph finite_state_machine {"); var indent = "\t"; builder.AppendLine("rankdir=LR;"); //builder.AppendLine("size="); for (state from = 0; from < size; ++from) { for (state to = 0; to < size; ++to) { input @in = transTable[from][to]; var input = @in.ToString(); if (@in == (char)Constants.Any) { input = "Theta"; } else if (@in == (char)Constants.EpsilonAny) { input = "Epsilon"; } if (@in != (char)Constants.None) { builder.AppendLine(indent + $"{from} -> {to} [ label = \"{input}\" ];"); } } } builder.AppendLine("}"); return(builder.ToString()); }
private static Object SanitizeCharacterForXml(Char c) { if (Char.IsWhiteSpace(c)) { return new XCData(c.ToString()); } return c; }
/// <summary>获取单字拼音</summary> /// <param name="ch"></param> /// <returns></returns> public static String Get(Char ch) { // 拉丁字符 if (ch <= '\x00FF') return ch.ToString(); // 标点符号、分隔符 if (Char.IsPunctuation(ch) || Char.IsSeparator(ch)) return ch.ToString(); // 非中文字符 if (ch < '\x4E00' || ch > '\x9FA5') return ch.ToString(); var arr = Encoding.Default.GetBytes(ch.ToString()); var chr = (Int16)arr[0] * 256 + (Int16)arr[1] - 65536; if (chr > 0 && chr < 160) return ch.ToString(); // 修正部分文字 // 修正“圳”字 if (chr == -9254) return "Zhen"; for (var i = pyValue.Length - 1; i >= 0; i--) { if (pyValue[i] <= chr) return pyName[i]; } return String.Empty; }
/// <summary> /// This is the function that is used to determine if the /// AutoComplete box should be automatically shown. /// </summary> /// <returns></returns> internal bool ShouldTrigger(Char newestChar) { String e = newestChar.ToString(); int len = MaxTriggerCharLength; if (base.Scintilla.Text.Length >= len) { String baseString = base.Scintilla.Text.Substring(base.Scintilla.Selection.Start - len, len); foreach (String s in TriggerChars) { if (s.Length <= baseString.Length) { if (s == baseString.Substring(0, s.Length)) { return true; } } } } return false; }
/// <summary> /// Hàm dùng để binding giá trị nhập của một Textbox chỉ được phép là chữ số /// Hàm này được gọi trong sự kiện Keypress /// </summary> /// <param name="pstrChar">e.Keychar</param> /// <param name="oTextBox">TextBox cần binding</param> /// <returns></returns> public static bool NumbersOnly(Char pstrChar, TextBox oTextBox) { if (pstrChar.ToString() != Constants.vbBack) { return IsNumeric(pstrChar) || IsNumeric(pstrChar.ToString() + oTextBox.Text) ? false : true; } return false; }
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { if (t[e.RowIndex][e.ColumnIndex] == ' ') { dataGridView1.CurrentCell.Value = gracz; t[e.RowIndex][e.ColumnIndex] = Convert.ToChar(gracz); if (!Wygrana(t, 'X', false) && !Wygrana(t, 'O', false) && !Remis(t, false)) { if (gracz == 'O') if (siX == false) { gracz = 'X'; label2.Text = gracz.ToString(); } else { Ruch(t, 'X'); } else { if (siO == false) { gracz = 'O'; label2.Text = gracz.ToString(); } else Ruch(t, 'O'); } } else { dataGridView1.Enabled = false; } } dataGridView1.CurrentCell.Selected = false; }
bool check(Char t) { int count = 0; int chk = 0; for (int i = 0; i < row - 1; i = i + 2) { for (int j = 0; j < col; j++) if (arr[i, j] == '1') { if (arr[i + 1, j - 1] == '1' && arr[i + 1, j + 1] == '1' && arr[i + 2, j] == '1' && arr[i + 1, j] == ' ') { arr[i + 1, j] = t; chk = 1; Graphics gf = CreateGraphics(); gf.DrawString(t.ToString(), new Font("Times New Roman", 12), Brushes.Black, new PointF(j * 25 + 95, i * 25 + 115)); count++; } } } if (chk == 1) return true; else return false; }
/// <summary> /// String.Contains() for Char /// </summary> public static bool Contains(this String s, Char c) { if (String.IsNullOrEmpty(s)) return false; return s.Contains(c.ToString()); }
/// <summary> /// Converts the value of the specified Unicode character to its equivalent SqlString representation. /// </summary> /// <param name="value">A Unicode character.</param> /// <returns>The SqlString equivalent of the Unicode character.</returns> public static SqlString ToSqlString(Char value) { return value.ToString(); }
/// <summary>Converts the value from <c>Char</c> to an equivalent <c>SqlString</c> value.</summary> public static SqlString ToSqlString(Char p) { return p.ToString(); }
private static Int32 MeasureKerning(FontGenerationParameters parameters, Graphics gfx, Font font, Char c1, Char c2) { if (Char.IsWhiteSpace(c1) || Char.IsWhiteSpace(c2)) return 0; var layoutArea = new SizeF(Single.MaxValue, Single.MaxValue); var c1Size = gfx.MeasureString(c1.ToString(), font, layoutArea, StringFormat.GenericTypographic); var c2Size = gfx.MeasureString(c2.ToString(), font, layoutArea, StringFormat.GenericTypographic); var kernedSize = gfx.MeasureString(String.Format("{0}{1}", c1, c2), font, layoutArea, StringFormat.GenericTypographic); return (Int32)(kernedSize.Width - (c1Size.Width + c2Size.Width)) - parameters.Overhang; }
/// <summary> /// todoComment /// </summary> /// <param name="AKey"></param> /// <param name="ADefault"></param> /// <returns></returns> public static System.Char GetCharDefault(String AKey, System.Char ADefault) { return(Convert.ToChar(TInternal.GetUserDefault(AKey, ADefault.ToString()))); }
public void SetLetter(System.Char l) { letter.text = l.ToString(); }
/// <summary> /// Converts the value of the specified nullable Unicode character to its equivalent String representation. /// </summary> /// <param name="value">A nullable Unicode character.</param> /// <returns>The String equivalent of the nullable Unicode character.</returns> public static String ToString(Char? value) { return value.ToString(); }
/// <summary> /// get char default /// </summary> /// <param name="AKey"></param> /// <param name="ADefault"></param> /// <returns></returns> public System.Char GetCharDefault(String AKey, System.Char ADefault) { return(Convert.ToChar(GetSystemDefault(AKey, ADefault.ToString()))); }
/// <summary> /// Converts the value of the specified nullable Unicode character to its equivalent SqlString representation. /// </summary> /// <param name="value">A nullable Unicode character.</param> /// <returns>The SqlString equivalent of the nullable Unicode character.</returns> public static SqlString ToSqlString(Char? value) { return value.HasValue ? value.ToString() : SqlString.Null; }
public static System.Char GetCharDefault(String AKey, System.Char ADefault, TDataBase ADataBase = null) { return(Convert.ToChar(GetUserDefault(AKey, ADefault.ToString()))); }
/// <summary> /// Consumes an escaped character AFTER the solidus has already been /// consumed. /// </summary> /// <returns>The escaped character.</returns> String ConsumeEscape(Char current) { if (current.IsHex()) { var escape = new List<Char>(); for (int i = 0; i < 6; i++) { escape.Add(current); current = Next; if (!current.IsHex()) break; } current = Previous; var code = Int32.Parse(new String(escape.ToArray()), NumberStyles.HexNumber); return Char.ConvertFromUtf32(code); } return current.ToString(); }
void updateFloatingCombo(Char keyChar) { if (dataGridView1.DataSource != null && dataGridView1.CurrentCell != null) { if (dataGridView1.CurrentCell.Value.ToString() != "Split") { // modify behavior based on the grid's column if (dataGridView1.CurrentCell.OwningColumn.Name == "Company") { dataGridView1.Enabled = false; // popup an edit box with companies floatingCombo.Items.Clear(); Rectangle tempR = dataGridView1.GetCellDisplayRectangle( dataGridView1.CurrentCell.ColumnIndex, dataGridView1.CurrentCell.RowIndex, true); tempR.Offset(dataGridView1.Location); floatingCombo.Bounds = tempR; floatingCombo.Text = dataGridView1.CurrentCell.Value.ToString(); floatingCombo.Show(); closeButton.Location = new Point(tempR.Right, tempR.Top); closeButton.Show(); floatingCombo.Items.AddRange(con.getCompanyList()); floatingCombo.Focus(); if (keyChar != new Char()) { floatingCombo.Text = keyChar.ToString(); } floatingCombo.Select(floatingCombo.Text.Length, 0); } else if (dataGridView1.CurrentCell.OwningColumn.Name == "Account") { dataGridView1.Enabled = false; // popup an edit box with accounts floatingCombo.Items.Clear(); Rectangle tempR = dataGridView1.GetCellDisplayRectangle( dataGridView1.CurrentCell.ColumnIndex, dataGridView1.CurrentCell.RowIndex, true); tempR.Offset(dataGridView1.Location); floatingCombo.Bounds = tempR; floatingCombo.Text = dataGridView1.CurrentCell.Value.ToString(); floatingCombo.Show(); closeButton.Location = new Point(tempR.Right, tempR.Top); closeButton.Show(); floatingCombo.Items.AddRange( con.getAccountList( // get the accounts that correspond to this row's Company. dataGridView1.CurrentRow.Cells["Company"].Value.ToString() )); floatingCombo.Focus(); if (keyChar != new Char()) { floatingCombo.Text = keyChar.ToString(); } floatingCombo.Select(floatingCombo.Text.Length, 0); } else { dataGridView1.Enabled = true; // hide the edit box floatingCombo.Items.Clear(); floatingCombo.Hide(); // hide button closeButton.Hide(); } } } }
void Ruch(Char[][] t, Char g) { List<Point> lista = new List<Point>(); Point wybor; MiniMax(ref lista, t, g, 0); Random rand = new Random(); wybor = lista[rand.Next(lista.Count)]; t[wybor.X][wybor.Y] = g; dataGridView1.Rows[wybor.X].Cells[wybor.Y].Value = g.ToString(); if (!Wygrana(t, 'X', false) && !Wygrana(t, 'O', false)) { } else if (Remis(t, false)) { } else { label2.Text = g.ToString(); dataGridView1.Enabled = false; } }
private Int32 GetPriority(Char c) { return GetPriority(c.ToString()); }
public IA5StringValue(Char str) { m_TypeID = Asn1Value.TypeID.IA5String; m_value = str.ToString(); }
/// <summary> /// 将全角转换为半角 /// </summary> /// <param name="newPressChar"></param> /// <returns></returns> private string ChangeHalfCode(Char newPressChar) { byte[] bytes = System.Text.Encoding.Unicode.GetBytes(newPressChar.ToString()); int aaa = Convert.ToInt32(bytes[0]); int bbb = Convert.ToInt32(bytes[1]); int cccc = bbb * 256 + aaa; if (cccc >= 65281 && cccc <= 65374) { bytes[1] = 0; bytes[0] = Convert.ToByte(cccc - 65248); string newChar = System.Text.Encoding.Unicode.GetString(bytes); return newChar; } else if (cccc == 12290) { return "."; } else { return newPressChar.ToString(); } }
/// <summary> /// 获取单字拼音 /// </summary> /// <param name="ch"></param> /// <returns></returns> public static String Get(Char ch) { // 拉丁字符 if (ch <= '\x00FF') return ch.ToString(); // 标点符号、分隔符 if (Char.IsPunctuation(ch) || Char.IsSeparator(ch)) return ch.ToString(); // 非中文字符 if (ch < '\x4E00' || ch > '\x9FA5') return ch.ToString(); var arr = Encoding.GetEncoding("gb2312").GetBytes(ch.ToString()); //Encoding.Default默认在中文环境里虽是GB2312,但在多变的环境可能是其它 //var arr = Encoding.Default.GetBytes(ch.ToString()); var chr = (Int16)arr[0] * 256 + (Int16)arr[1] - 65536; //***// 单字符--英文或半角字符 if (chr > 0 && chr < 160) return ch.ToString(); #region 中文字符处理 // 判断是否超过GB2312-80标准中的汉字范围 if (chr > lastChCode || chr < firstChCode) { return ch.ToString(); ; } // 如果是在一级汉字中 else if (chr <= lastOfOneLevelChCode) { // 将一级汉字分为12块,每块33个汉字. for (int aPos = 11; aPos >= 0; aPos--) { int aboutPos = aPos * 33; // 从最后的块开始扫描,如果机内码大于块的第一个机内码,说明在此块中 if (chr >= pyValue[aboutPos]) { // Console.WriteLine("存在于第 " + aPos.ToString() + " 块,此块的第一个机内码是: " + pyValue[aPos * 33].ToString()); // 遍历块中的每个音节机内码,从最后的音节机内码开始扫描, // 如果音节内码小于机内码,则取此音节 for (int i = aboutPos + 32; i >= aboutPos; i--) { if (pyValue[i] <= chr) { // Console.WriteLine("找到第一个小于要查找机内码的机内码: " + pyValue[i].ToString()); return pyName[i]; } } break; } } } // 如果是在二级汉字中 else { int pos = Array.IndexOf(otherChinese, ch.ToString()); if (pos != decimal.MinusOne) { return otherPinYin[pos]; } } #endregion 中文字符处理 //if (chr < -20319 || chr > -10247) { // 不知道的字符 // return null; //for (var i = pyValue.Length - 1; i >= 0; i--) //{ // if (pyValue[i] <= chr) return pyName[i];//这只能对应数组已经定义的 //} return String.Empty; }
public bool runTest() { Console.WriteLine(s_strTFPath + " " + s_strTFName + " , for " + s_strClassMethod + " , Source ver " + s_strDtTmVer); int iCountErrors = 0; int iCountTestcases = 0; String strLoc = "Loc_000oo"; String strValue = String.Empty; try { String str1; Char[] chArr; int iResult = 0; int[] iArrInvalidValues = new Int32[]{ -1, -2, -100, -1000, -10000, -100000, -1000000, -10000000, -100000000, -1000000000, Int32.MinValue}; int[] iArrLargeValues = new Int32[]{ Int32.MaxValue, Int32.MaxValue-1, Int32.MaxValue/2 , Int32.MaxValue/10 , Int32.MaxValue/100 }; int[] iArrValidValues = new Int32[]{ 10000, 5000 , 1000 , 0 }; IntlStrings intl = new IntlStrings(); String intlString = intl.GetString(20, true, true); Char[] chrArr = intlString.ToCharArray(); iCountTestcases++; for(int iLoop = 0 ; iLoop < iArrInvalidValues.Length ; iLoop++ ){ try { intlString.CopyTo(iArrInvalidValues[iLoop], chrArr, 5 , 5); iCountErrors++; Console.Error.WriteLine( "Error_0000!!!! Expected exception not occured" ); } catch ( ArgumentOutOfRangeException ){ } catch ( Exception ex ) { Console.Error.WriteLine( "Error_2222!!! Unexpected exception " + ex.ToString() ); iCountErrors++ ; } } iCountTestcases++; for(int iLoop = 0 ; iLoop < iArrInvalidValues.Length ; iLoop++ ){ try { intlString.CopyTo(5, chrArr, iArrInvalidValues[iLoop], 5); iCountErrors++; Console.Error.WriteLine( "Error_4444!!!! Expected exception not occured" ); } catch ( ArgumentOutOfRangeException ){ } catch ( Exception ex ) { Console.Error.WriteLine( "Error_5555!!! Unexpected exception " + ex.ToString() ); iCountErrors++ ; } } iCountTestcases++; for(int iLoop = 0 ; iLoop < iArrInvalidValues.Length ; iLoop++ ){ try { intlString.CopyTo(5, chrArr, 5, iArrInvalidValues[iLoop] ); iCountErrors++; Console.Error.WriteLine( "Error_7777!!!! Expected exception not occured" ); } catch ( ArgumentOutOfRangeException ){ } catch ( Exception ex ) { Console.Error.WriteLine( "Error_8888!!! Unexpected exception " + ex.ToString() ); iCountErrors++ ; } } iCountTestcases++; for(int iLoop = 0 ; iLoop < iArrLargeValues.Length ; iLoop++ ){ try { intlString.CopyTo(iArrLargeValues[iLoop], chrArr, 5 , 5); } catch ( ArgumentOutOfRangeException ){ } catch ( Exception ex ) { Console.Error.WriteLine( "Error_2134!!! Unexpected exception " + ex.ToString() ); iCountErrors++ ; } } iCountTestcases++; for(int iLoop = 0 ; iLoop < iArrLargeValues.Length ; iLoop++ ){ try { intlString.CopyTo(5, chrArr, iArrLargeValues[iLoop], 5); } catch ( ArgumentOutOfRangeException ){ } catch ( Exception ex ) { Console.Error.WriteLine( "Error_8787!!! Unexpected exception " + ex.ToString() ); iCountErrors++ ; } } iCountTestcases++; for(int iLoop = 0 ; iLoop < iArrLargeValues.Length ; iLoop++ ){ try { intlString.CopyTo(5, chrArr, 5, iArrLargeValues[iLoop]); } catch ( ArgumentOutOfRangeException ){ } catch ( Exception ex ) { Console.Error.WriteLine( "Error_43433!!! Unexpected exception " + ex.ToString() ); iCountErrors++ ; } } intlString = intl.GetString( 100000, true , true ); str1 = intlString ; iCountTestcases++; for(int iLoop = 0 ; iLoop < iArrValidValues.Length ; iLoop++ ){ try { chrArr = new Char[iArrValidValues[iLoop]]; intlString.CopyTo(iLoop*100, chrArr , 0, iArrValidValues[iLoop]); if ( iResult != 0 ){ iCountErrors++; Console.Error.WriteLine( "Error_8787!!!! CopyTo returned incorrect value.... Expected...{0}, Actual...{1}", 0, iResult ); } } catch ( Exception ex ){ Console.Error.WriteLine( "Error_4564!!! Unexpected exception " + ex.ToString() ); iCountErrors++ ; } } strLoc = "Loc_0939v"; str1 = String.Empty; iCountTestcases++; try { str1.CopyTo(0, null, 0, 0); iCountErrors++; printerr( "Error_1908c! ArgumentNullException expected"); } catch (ArgumentNullException aExc) { Console.WriteLine("Info_18f84! Caught Expected Exception , exc=="+aExc.Message); } catch (Exception exc) { iCountErrors++; printerr("Error_0129x! ArgumentNullException expected, got exc=="+exc.ToString()); } strLoc = "Loc_09ucd"; str1 = String.Empty; chArr = new Char[0]; iCountTestcases++; try { str1.CopyTo(-1, chArr, 0, 0); iCountErrors++; printerr( "Error_109uc! ArgumentOutOfRangeException expected"); } catch (ArgumentOutOfRangeException aExc) { Console.WriteLine("Info_109fa! Caught expected exception , exc=="+aExc.Message); } catch (Exception exc) { iCountErrors++; printerr( "Error_1098u! ArgumentOutOfRangeException expected, got exc=="+exc.ToString()); } strLoc = "Loc_09f8v"; str1 = String.Empty; chArr = new Char[0]; iCountTestcases++; try { str1.CopyTo(1, chArr, 0, 0); iCountErrors++; printerr( "Error_1908v! ArgumentOutOfRangeException expected"); } catch ( ArgumentOutOfRangeException aExc) { Console.WriteLine("Info_09t95! Caught expected exception , exc=="+aExc.Message); } catch ( Exception exc) { iCountErrors++; printerr( "Error_228ch! ArgumentOutOfRangeException expected, got exc=="+exc.ToString()); } strLoc = "Loc_98yt5"; str1 = "Hello"; chArr = new Char[0]; iCountTestcases++; try { str1.CopyTo(3, chArr, -1, 1); iCountErrors++; printerr( "Error_498gb! ArgumentOutOfRangeException expected"); } catch (ArgumentOutOfRangeException aExc) { Console.WriteLine("Info_298vh! Caught expected exception , exc=="+aExc.Message); } catch (Exception exc) { iCountErrors++; printerr( "Error_20g9f! ArgumentOutOfRangeException expected, got exc=="+exc.ToString()); } strLoc = "Loc_2998c"; str1 = "Hello"; chArr = new Char[0]; iCountTestcases++; try { str1.CopyTo(2, chArr, 0, 1); iCountErrors++; printerr("Error_28gh8! ArgumentOutOfRangeException expected"); } catch ( ArgumentOutOfRangeException aExc) { Console.WriteLine("Info_298gb! Caught expected excpetion , exc=="+aExc.Message); } catch ( Exception exc ) { iCountErrors++; printerr( "Error_298hb! ArgumentOutOfRangeException expected, got exc=="+exc.ToString()); } strLoc = "Loc_209uc"; str1 = "HelloWorld"; chArr = new Char[2]; str1.CopyTo(4, chArr, 0, 2); iCountTestcases++; if(chArr[0] != 'i' && chArr[1] != 'W') { iCountErrors++; printerr( "Error_287fv! Incorrect chars in array [0]=="+chArr[0].ToString()+" , [1]=="+chArr[1].ToString()); } intl = new IntlStrings(); str1 = intl.GetString(8, true, true); chArr = new Char[2]; str1.CopyTo(0, chArr, 0, 2); iCountTestcases++; if(chArr[0] != str1[0] && chArr[1] != str1[1]) { iCountErrors++; printerr( "Error_287fv! Incorrect chars in array [0]=="+chArr[0].ToString()+" , [1]=="+chArr[1].ToString()); } strLoc = "Loc_298hg"; str1 = "HelloWorld"; chArr = new Char[15]; str1.CopyTo(4, chArr, 5, 2); iCountTestcases++; if(chArr[5] != 'i' && chArr[6] != 'W') { iCountErrors++; printerr( "Error_7yg73! Incorrect chars in array [5]=="+chArr[5].ToString()+" , [6]=="+chArr.ToString()); } strLoc = "Loc_298hg"; str1 = "Bug"; chArr = new Char[3]; str1.CopyTo(0, chArr, 0, 3); iCountTestcases++; if(chArr[0] != 'B' && chArr[1] != 'u' && chArr[2] != 'g') { iCountErrors++; printerr( "Error_27ggb! Incorrect chars in array"); } str1 = "Bug"; chArr = new Char[7]; str1.CopyTo(0, chArr, 2, 3); iCountTestcases++; if(chArr[2] != 'B' && chArr[3] != 'u' && chArr[4] != 'g') { iCountErrors++; printerr( "Error_958vh! Incorrect chars in array"); } strLoc = "Loc_27hgt"; str1 = "Bug"; chArr = new Char[10]; iCountTestcases++; try { str1.CopyTo(2, chArr, 3, 2); Console.WriteLine(chArr[2]); iCountErrors++; printerr( "Error_2gh88! ArgumentOutOfRangeException expected"); } catch ( ArgumentOutOfRangeException aExc) { Console.WriteLine("Info_498gh! Caught expected Exception, exc=="+aExc.Message); } catch ( Exception exc) { iCountErrors++; printerr( "Error_209u9! ArgumentException expected , got exc=="+exc.ToString()); } str1 = "Bug"; chArr = new Char[4]; iCountTestcases++; try { str1.CopyTo(1, chArr, 3, 3); iCountErrors++; printerr( "Error_29hvg! ArgumentException expected"); } catch ( ArgumentException aExc) { Console.WriteLine("Info_287gb! Caught expected Exception, exc=="+aExc.Message); } catch (Exception exc) { iCountErrors++; printerr( "Error_298g8! ArgumentException expected, got exc=="+exc.ToString()); } StringBuilder sb1 = new StringBuilder(""); for(int i = 0 ; i < 100000 ; i++) sb1.Append('o'); str1 = sb1.ToString(); } catch (Exception exc_general ) { ++iCountErrors; Console.WriteLine (s_strTFAbbrev + " : Error Err_8888yyy! strLoc=="+ strLoc +", exc_general=="+exc_general.ToString()); } if ( iCountErrors == 0 ) { return true; } else { return false;} }
private void FirstCharSearch(Char value) { if (value == ' ') return; _searchString = value.ToString(); Game node = null; if (_gameList.SelectedGame != null) node = _gameList.SelectedGame.NextGame; // ++next visible if (node == null) node = _gameList.NextVisibleGame; if (node != null) foreach (string label in IterateNodeLabels(node, SearchType.Description)) { if (label.StartsWith(_searchString)) { _gameList.SelectedGame = _currentNode; return; } } }
// Overrides System.Object.ToString. //| <include path='docs/doc[@for="Char.ToString"]/*' /> public override String ToString() { return(Char.ToString(m_value)); }