本文整理汇总了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';
}
示例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();
}
示例3: applyRule
public String applyRule(Char inCharater)
{
foreach (Rule rule in ruleList)
{
if (rule.getPredecessor() == inCharater.ToString())
return rule.getSuccessor();
}
return "";
}
示例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;
}
示例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();
}
示例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());
}
}
示例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;
}
}
}
示例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);
}
}
}
示例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));
}
示例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;
}
示例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;
}
示例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());
}
示例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(); }
示例14: GetPriority
private Int32 GetPriority(Char c)
{
return GetPriority(c.ToString());
}
示例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();
}
}
}
}