一、
if (key.Childrens.Find(delegate(ProductPropertyKey p) { return p.ID == Shove._Convert.StrToLong(ids2[0], 0); }) != null)
{
firstProerty = ids2[0];
}
else if (key.Childrens.Find(delegate(ProductPropertyKey p) { return p.ID == Shove._Convert.StrToLong(ids2[1], 0); }) != null)
{
firstProerty = ids2[1];
}
二、
string ids = null;
for (int i = 0; i < dt.Rows.Count; i++)
{
ids += dt.Rows[i][0] + ",";
}
ids = ids.Replace(",", "");
HtmlGenericControl PIds = Page.Form.FindControl("Ids") as HtmlGenericControl;
PIds.InnerText = ids.ToString();
三、
int age = 111;
if (lstPerson.Find(delegate(Person p) { return p.Age == age; }) != null)
{
Response.Write("fffffffffffffff");
}
else
{
Response.Write("bbbbbbbbbbbbbbbbbb");
}
java代码:
if(a.startsWith(b))
//判断字符串a 是不是以字符串b开头.
if(a.endsWith(b))
//判断字符串a 是不是以字符串b结尾.
C#代码 给服务器控件加样式
ddlCompany.Attributes.CssStyle.Add("display", "none");
string[] _keyWords = keyWords.Split(new char[1] { ',' }); //用多个字符分隔
string[] sArray = keyWords.Split(','); //用单个字符分隔
using System.Text.RegularExpressions;
string str="aaajsbbbjsccc";
string[] sArray=Regex.Split(str,"js",RegexOptions.IgnoreCase); //用字符串分隔
foreach (string i in sArray) Response.Write(i.ToString() + "<br>");
输出结果:
aaa
bbb
ccc
string keys = keyWords.ToString();
string key = string.Empty;
if (keys.StartsWith(","))
{
StringBuilder str = new StringBuilder();
string[] strArray = keys.Split(',');
foreach (String tmpStr in strArray)
{
if (tmpStr.Length > 0)
str.Append(tmpStr).Append(",");
}
if (str.ToString().EndsWith(","))
{
keys = str.ToString().Substring(0, str.Length - 1);
}
}
else
{
keys = keys.ToString().Substring(0, keys.Length - 1);
}