当前位置: 首页>>代码示例>>C#>>正文


C# Char.ToString方法代码示例

本文整理汇总了C#中System.Char.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Char.ToString方法的具体用法?C# Char.ToString怎么用?C# Char.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Char的用法示例。


在下文中一共展示了Char.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: xor

 public Char xor(Char a, Char b)
 {
     if(String.Compare(a.ToString(),b.ToString(),true)==0){
         return '0';
     }
     return '1';
 }
开发者ID:SnowFace,项目名称:Rechnerstrukturen,代码行数:7,代码来源:Dualoperationen.cs

示例2: AlphabetSection

 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();
 }
开发者ID:serakrin,项目名称:presentations,代码行数:7,代码来源:AlphabetSection.cs

示例3: applyRule

 public String applyRule(Char inCharater)
 {
     foreach (Rule rule in ruleList)
     {
         if (rule.getPredecessor() == inCharater.ToString())
             return rule.getSuccessor();
     }
     return "";
 }
开发者ID:DuxClarus,项目名称:Uat-Portfolio,代码行数:9,代码来源:LSystemManager.cs

示例4: Split

        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;
        }
开发者ID:zformular,项目名称:ValueHelper,代码行数:13,代码来源:StringHelper.cs

示例5: FormatName

        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();
        }
开发者ID:cdsalmons,项目名称:OrleansTemplates,代码行数:16,代码来源:NamingUtils.cs

示例6: Add

            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());
                }
            }
开发者ID:RSchwoerer,项目名称:Terminals,代码行数:17,代码来源:TerminalControl.Parser.cs

示例7: FirstCharSearch

		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;
				}
			}
		}
开发者ID:john-peterson,项目名称:processhacker,代码行数:21,代码来源:IncrementalSearch.cs

示例8: Search

		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);
				}
			}
		}
开发者ID:AndrewTPohlmann,项目名称:open-hardware-monitor,代码行数:21,代码来源:IncrementalSearch.cs

示例9: GetDrawStringOffset

        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));
        }
开发者ID:RSchwoerer,项目名称:Terminals,代码行数:21,代码来源:TerminalControl.Drawing.cs

示例10: dataGridView1_CellClick

        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;
        }
开发者ID:skamenialo,项目名称:Kolko_i_krzyzyk,代码行数:37,代码来源:Form1.cs

示例11: check

        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;
        }
开发者ID:umar-qureshi2,项目名称:UG-Courses,代码行数:27,代码来源:Game.cs

示例12: Contains

 /// <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());
 }
开发者ID:thenuts,项目名称:SwissEphNet,代码行数:8,代码来源:StringExtensions.cs

示例13: ToSqlString

 /// <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(); }
开发者ID:mstaessen,项目名称:fluorinefx,代码行数:6,代码来源:Convert.cs

示例14: GetPriority

 private Int32 GetPriority(Char c)
 {
     return GetPriority(c.ToString());
 }
开发者ID:Letractively,项目名称:jntemplate,代码行数:4,代码来源:Calculator.cs

示例15: updateFloatingCombo

        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();
                    }
                }

            }
        }
开发者ID:j3wbacca,项目名称:Trillium-CC-Allocator,代码行数:76,代码来源:Form1.cs


注:本文中的System.Char.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。