本文整理汇总了C#中System.String.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# String.Equals方法的具体用法?C# String.Equals怎么用?C# String.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.String
的用法示例。
在下文中一共展示了String.Equals方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddType
/// <summary>
/// Add the specified type.
/// </summary>
/// <param name="theType">The type to add.</param>
public void AddType(String theType)
{
if (theType.Equals("b"))
{
AddType(EPLValueType.BooleanType);
}
else if (theType.Equals("e"))
{
AddType(EPLValueType.EnumType);
}
else if (theType.Equals("f"))
{
AddType(EPLValueType.FloatingType);
}
else if (theType.Equals("i"))
{
AddType(EPLValueType.IntType);
}
else if (theType.Equals("s"))
{
AddType(EPLValueType.StringType);
}
else if (theType.Equals("*"))
{
AddAllTypes();
}
else
{
throw new EACompileError("Unknown type: " + theType);
}
}
示例2: reportesHorario
public void reportesHorario(String opcion)
{
if (opcion.Equals("Todos"))
{
horarioS.conexionS();
dgReporte.AutoGenerateColumns = true;
dgReporte.DataSource = horarioS.listarHorarios();
gbResultado.Visible = true;
dgReporte.Visible = true;
horarioS.cerrarConexion();
}
if (opcion.Equals("Disponibles"))
{
horarioS.conexionS();
dgReporte.AutoGenerateColumns = true;
dgReporte.DataSource = horarioS.listarHorariosDisponibles();
gbResultado.Visible = true;
dgReporte.Visible = true;
horarioS.cerrarConexion();
}
if (opcion.Equals("Ocupados"))
{
horarioS.conexionS();
dgReporte.AutoGenerateColumns = true;
dgReporte.DataSource = horarioS.listarHorariosOcupados();
gbResultado.Visible = true;
dgReporte.Visible = true;
horarioS.cerrarConexion();
}
}
示例3: colorBodyParts
private void colorBodyParts(String color)
{
Color bodyColor = Color.Black;
if (color.Equals("Red"))
{
bodyColor = Color.Red;
}
else if (color.Equals("Yellow"))
{
bodyColor = Color.Yellow;
}
else if (color.Equals("Green"))
{
bodyColor = Color.Green;
}
else if (color.Equals("Blue"))
{
bodyColor = Color.Blue;
}
headShape.BorderColor = bodyColor;
rightArmShape.BorderColor = bodyColor;
leftArmShape.BorderColor = bodyColor;
rightLegShape.BorderColor = bodyColor;
leftLegShape.BorderColor = bodyColor;
bodyShape.BorderColor = bodyColor;
}
示例4: ArraysFullyIncluded
public static SqlBoolean ArraysFullyIncluded(String AArray, String ASubArray, Char ASeparator)
{
//String
// LArray = (AArray.IsNull ? null : AArray.Value),
// LSubArray = (ASubArray.IsNull ? null : ASubArray.Value);
if (String.IsNullOrEmpty(ASubArray) || ASubArray.Equals(ASeparator))
return true;
if (String.IsNullOrEmpty(AArray) || AArray.Equals(ASeparator))
return false;
if (AArray.Equals("*"))
return new SqlBoolean(true);
if (ASubArray.Equals("*"))
return new SqlBoolean(false);
AArray = ASeparator + AArray + ASeparator;
foreach(String LItem in ASubArray.Split(new char[]{ASeparator}, StringSplitOptions.RemoveEmptyEntries))
{
if(AArray.IndexOf(ASeparator + LItem + ASeparator) == -1)
return false;
}
return true;
}
示例5: InternalGet
/// <summary>
/// retrieves value for key from internal storage
/// </summary>
/// <param name="key">name of value to get</param>
/// <returns>value as object</returns>
public override Object InternalGet(String key) {
Object o = null;
/*
* special token : NODE
*
* returns current node
*/
if (key.Equals(NODE)) {
return PeekNode();
}
/*
* ATTRIB - returns attribute map
*/
if (key.Equals(ATTRIB)) {
DvslNode n = PeekNode();
return n.AttribMap;
}
/*
* start with local storage
*/
return ctx[key];
}
示例6: CheckOutputValue
private void CheckOutputValue(Rect rect, String recognizedCharacter, bool isError, StrokeCollection removedStrokes)
{
//Check out if it is header box
if (!_truthTable.IsHeaderBox(rect))
{
if (recognizedCharacter.Equals("1") || recognizedCharacter.Equals("l")
|| recognizedCharacter.Equals("|"))
{
_truthTable.insertValue(rect, "1");
}
else if (recognizedCharacter.Equals("0") || recognizedCharacter.Equals("O"))
{
_truthTable.insertValue(rect, "0");
}
else
{
_truthTable.DisplayInputErrorInfo(rect, removedStrokes);
}
}else {
if (!isError)
{
if (_truthTable.default_terms_names.Contains(recognizedCharacter))
{
_truthTable.insertValue(rect, recognizedCharacter);
}
else {
_truthTable.DisplayInputErrorInfo(rect, removedStrokes);
}
}
else {
_truthTable.DisplayInputErrorInfo(rect, removedStrokes);
}
}
}
示例7: frmEntradaSaida
public frmEntradaSaida(String tipoOperacao, Usuario user, String dataCaixa, bool permiteEscrita, String opId)
{
InitializeComponent();
this.opId = opId;
mov = new Movimentacao();
tipoOp = tipoOperacao;
dtCaixa = dataCaixa;
this.Text = tipoOperacao;
this.user = user;
lblUser.Text = user.Login;
lblData.Text = dataCaixa;
if (tipoOperacao.Equals("Entrada"))
btnConfirma.Image = imageList1.Images[0];
if (tipoOperacao.Equals("Saída"))
btnConfirma.Image = imageList1.Images[1];
if (!permiteEscrita)
{
ttbDesc.Enabled = false;
ttbValor.Enabled = false;
btnConfirma.Visible = false;
mov.EntradaId = opId;
if (tipoOperacao.Equals("Entrada"))
mov = mov.getEntradaById();
else
mov = mov.getSaidaById();
ttbDesc.Text = mov.Desc;
ttbValor.Text = new Utils().moneyFormata(mov.Valor);
lblData.Text = DateTime.Parse(mov.CaiData).ToShortDateString();
}
}
示例8: Configure
public static void Configure(ref Int32 intervalStart, ref Int32 intervalEnd, ref String returnType, ref String actualCode)
{
ConfigurationForm form = new ConfigurationForm();
form.edtEndInt.Text = intervalEnd.ToString();
form.edtStartInt.Text = intervalStart.ToString();
form.edtCode.Text = actualCode;
if (returnType.Equals("Int32"))
form.cbbReturnType.SelectedIndex = 0;
else if (returnType.Equals("Double"))
form.cbbReturnType.SelectedIndex = 1;
else
form.cbbReturnType.SelectedIndex = 2;
form.ControlUIChanges();
if (form.ShowDialog() == DialogResult.OK)
{
intervalEnd = Convert.ToInt32(form.edtEndInt.Text);
intervalStart = Convert.ToInt32(form.edtStartInt.Text);
actualCode = form.edtCode.Text;
returnType = form.cbbReturnType.Text;
}
}
示例9: assignClassStartDay
// worst code I've ever written in my life is below. Too tired to write creative algorithm....
private int assignClassStartDay(String day, DateTime semesterStart)
{
DateTime d = new DateTime();
if (day.Equals("Mo"))
{
d = new DateTime(2011, 11, 7, 00, 00, 00, 00);
}
else if (day.Equals("Tu"))
{
d = new DateTime(2011, 11, 8, 00, 00, 00, 00);
}
else if (day.Equals("We"))
{
d = new DateTime(2011, 11, 9, 00, 00, 00, 00);
}
else if (day.Equals("Th"))
{
d = new DateTime(2011, 11, 10, 00, 00, 00, 00);
}
else if (day.Equals("Fr"))
{
d = new DateTime(2011, 11, 11, 00, 00, 00, 00);
}
TimeSpan t = semesterStart - d;
double diff = Math.Floor(t.TotalDays) % 7;
int daysUntil = Convert.ToInt32(7 - diff); // days from start of semester that first class occurs
return semesterStart.Day + daysUntil;
}
示例10: getDao
public static Object getDao(String daoName)
{
if (daoName.Equals("DELIVERY_NOTE"))
{
IDeliveryNoteDAO dao = new DeliveryNoteDAOImpl();
return dao;
}
else if (daoName.Equals("RECEIVE_NOTE"))
{
var dao = new ReceiveNoteDAOImpl();
return dao;
}
else if(daoName.Equals("CAR"))
{
ICarDAO dao = new CarDAOImpl();
return dao;
}
else if (daoName.Equals("LOCATION"))
{
ILocationDAO dao = new LocationDAOImpl();
return dao;
}
else
{
return null;
}
}
示例11: loadResult
private void loadResult(string p,String type)
{
if (type.Equals("caythuoc"))
{
DataTable dt = admin.dao.CayThuoc_DAO.searchTenCayThuoc(p);
lv_Result.DataSource = dt;
lv_Result.DataBind();
}
else if(type.Equals("hocaythuoc"))
{
DataTable dt = admin.dao.CayThuoc_DAO.searchhocaythuoc(p);
lv_Result.DataSource = dt;
lv_Result.DataBind();
}
else if (type.Equals("baithuoc"))
{
DataTable dt = admin.dao.CayThuoc_DAO.searchBaiThuoc(p);
lv_Result.DataSource = dt;
lv_Result.DataBind();
}
else {
Response.Redirect("index.aspx");
}
}
示例12: UpdateNotificationStatus
public ActionResult UpdateNotificationStatus(String Type) // assumes the enum is typeof EmployeeStatus
{
if (Type.Equals("Admin"))
{
foreach (var admin in db.SystemAdmins)
{
RegisteredUser registeredUser = null;
registeredUser = db.RegisteredUsers.Find(admin.RegisteredUserRefId);
registeredUser.NotificationStatus += 1;
db.Entry(registeredUser).State = EntityState.Modified;
LoadData();
}
}
else if (Type.Equals("GeneralUser"))
{
foreach (var users in db.GeneralUsers)
{
RegisteredUser registeredUser = null;
registeredUser = db.RegisteredUsers.Find(users.RegisteredUserRefId);
registeredUser.NotificationStatus += 1;
db.Entry(registeredUser).State = EntityState.Modified;
}
}
db.SaveChanges();
return Json(true);
}
示例13: list
/// <summary>
/// set query to select patient ID and nurse ID. Search for patient.
/// </summary>
/// <param name="field"></param>
/// <param name="value"></param>
/// <param name="data"></param>
/// <returns></returns>
public Data list(String field, String value,Data data)
{
String query = "Select * From history A, Users B WHERE A.patientId = B.UserID AND A.patientId = @pId AND A.staffId = @NurseID AND status = '0' <SEARCH> <DATE> ORDER BY historyId DESC";
String date = data.getString("date");
if (field.Equals(""))
{
query = query.Replace("<SEARCH>", "");
}
else if (field.Equals("memo"))
{
query = query.Replace("<SEARCH>", "AND memo LIKE '%" + value + "%'");
}
else if (field.Equals("patientId"))
{
query = query.Replace("<SEARCH>", "AND patientId LIKE '%" + value + "%'");
}
if (date.Equals(""))
{
query = query.Replace("<DATE>", "");
}
else
{
query = query.Replace("<DATE>", "AND CONVERT(VARCHAR(10), A.date, 103) = '<DATE>'".Replace("<DATE>", date));
}
return select(query, data);
}
示例14: newEncoder
public IEncoder newEncoder(String encodingSchema)
{
if(encodingSchema.Equals("BER",StringComparison.CurrentCultureIgnoreCase)) {
return new org.bn.coders.ber.BEREncoder();
}
else
if (encodingSchema.Equals("PER", StringComparison.CurrentCultureIgnoreCase) ||
encodingSchema.Equals("PER/Aligned", StringComparison.CurrentCultureIgnoreCase) ||
encodingSchema.Equals("PER/A", StringComparison.CurrentCultureIgnoreCase))
{
return new org.bn.coders.per.PERAlignedEncoder();
}
else
if (encodingSchema.Equals("PER/Unaligned", StringComparison.CurrentCultureIgnoreCase)||
encodingSchema.Equals("PER/U", StringComparison.CurrentCultureIgnoreCase))
{
return new org.bn.coders.per.PERUnalignedEncoder();
}
else
if (encodingSchema.Equals("DER", StringComparison.CurrentCultureIgnoreCase))
{
return new org.bn.coders.der.DEREncoder();
}
else
return null;
}
示例15: Trigger
/**
* Construct trigger with the object that will trigger the...trigger. Trigger.
*
* triggeringObject - The object that the trigger is checking a condition on.
* fieldName - Name of the field on the object to check the condition on.
* comparison - The comparison to use in the conditional.
* value - The value to compare the field against.
*/
public Trigger(Object triggeringObject, String fieldName, String comparison, String value)
{
this.triggeringObject = triggeringObject;
eventList = new List<Event>();
// Get the field using reflection.
triggeringField = triggeringObject.GetType().GetField(fieldName,
BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
// Store an int to represent the comparison.
if (comparison.Equals(">"))
{
this.comparison = 1;
}
else if (comparison.Equals("<"))
{
this.comparison = -1;
}
else if (comparison.Equals("=="))
{
this.comparison = 0;
}
// Parse the value to an int.
this.value = Int32.Parse(value);
}