本文整理汇总了C#中String.Count方法的典型用法代码示例。如果您正苦于以下问题:C# String.Count方法的具体用法?C# String.Count怎么用?C# String.Count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类String
的用法示例。
在下文中一共展示了String.Count方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: userCreateAndSession
private bool userCreateAndSession()
{
//+ email + "&name=" + name + "&social=" + social + "&socialType=" + socialtype + "&image=" + picture
if (Request["email"] != null && Request["name"] != null && Request["social"] != null && Request["socialType"] != null && Request["image"] != null)
{
String QEmail = Request["email"];
String Qname = Request["name"];
String Qsocial = Request["social"];
String QsocialType = Request["socialType"];
String Qpicture = Request["image"];
String[] SplitName = new String[3];
userMasterBO userMasterBO = new userMasterBO();
userMasterBAL userMasterBAL = new userMasterBAL();
SplitName = Qname.Split(' ');
//give the code to insert data into the usermaster table.
userMasterBO.email = QEmail;
userMasterBO.firstName = SplitName[0];
userMasterBO.lastName = (SplitName.Count() > 1) ? SplitName[1] : "NULL";
userMasterBO.middleName = (SplitName.Count() > 2) ? SplitName[2] : "NULL";
userMasterBO.password = "";
userMasterBO.socialNetwork = true;
userMasterBO.status = true;
userMasterBO.roleId = 3; //3 for user , 2 for mp,1 for admin, 4 for moderator
userMasterBO.snTypeId = userMasterBAL.getSocialNetworkId(QsocialType); //fetch the corresponding id of socialnetwork
userMasterBO.profilePicPath = (Qpicture.Length > 1) ? Qpicture : "NULL";
//insert data into the database.
string msg = userMasterBAL.insertUser(userMasterBO).ToString();
userMasterBO.guid = Convert.ToInt64(userMasterBAL.getGuid(userMasterBO));
guId = userMasterBO.guid;
name = userMasterBO.firstName;
Email = userMasterBO.email;
CreateSession();
return true;
}
else
return false;
}
示例2: BuildCarListFromQuery
protected void BuildCarListFromQuery(String[] args)
{
int CarsToShow = m_nCarsPerPage;
String advancedOptions = "";
if (LocationDL.SelectedItem.Text != "")
advancedOptions += " AND vehicle.dealership = " + LocationDL.SelectedValue;
if (VinDL.SelectedItem.Text != "")
advancedOptions += " AND vehicle.vin = \"" + VinDL.SelectedValue + "\"";
if (ColorDL.SelectedItem.Text != "")
advancedOptions += " AND vehicle.color = \"" + ColorDL.SelectedValue + "\"";
if (VehicleTypeDL.SelectedItem.Text != "")
advancedOptions += " AND vehicle_type.vehicle_type = \"" + VehicleTypeDL.SelectedValue + "\"";
if (args.Count() == 0 && advancedOptions.Equals(""))
{
SearchError.Text = "Please enter a search term(s) and/or choose filters below";
return;
}
DataSet dsCars = DataAccess.GetSearchedCars(args, advancedOptions);
DataTable dtCarsInfo = dsCars.Tables[0];
if (dtCarsInfo.Rows.Count == 0)
{
SearchError.Text = "No vehicles found matching the information given";
return;
}
if (dtCarsInfo.Rows.Count < m_nCarsPerPage)
{
CarsToShow = dtCarsInfo.Rows.Count;
}
int CurrentPosition = m_nCarsPerPage * (m_nCurrentPage - 1);
if (dtCarsInfo.Rows.Count - CurrentPosition < 25)
{
CarsToShow = dtCarsInfo.Rows.Count - CurrentPosition;
}
if (CarsToShow > 0)
{
for (int i = CurrentPosition; i < CurrentPosition + CarsToShow; i++)
{
DataRow drSingleCar = dtCarsInfo.Rows[i];
TableRow newCarInfoRow = new TableRow();
TableCell newCarInfoCell = new TableCell();
TableCell PlaceHolderCell = new TableCell();
//PlaceHolderCell.Style.Add(HtmlTextWriterStyle.Width, "20%");
newCarInfoCell.Controls.Add(BuildSingleCarHTMLTable(drSingleCar));
newCarInfoRow.Cells.Add(PlaceHolderCell);
newCarInfoRow.Cells.Add(newCarInfoCell);
m_tblListofCars.Rows.Add(newCarInfoRow);
}
}
}
示例3: Main
public static void Main(String[] args)
{
try
{
Curl.GlobalInit(CurlInitFlag.All);
using (var easy = new CurlEasy())
{
easy.WriteFunction = OnWriteData;
easy.SslContextFunction = OnSslContext;
easy.Url = args.Count() > 1 ? args[0] : "https://www.amazon.com";
easy.CaInfo = "curl-ca-bundle.crt";
easy.Perform();
}
Curl.GlobalCleanup();
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}
示例4: EmailValidate
private static bool EmailValidate(String email)
{
//if ((email.IndexOf("@") == -1) || (email.Count(x => x == '@')))
if (email.Count(x => x == '@') != 1)
{
return false; // brak @ lub kilkukrotnie w adresie
}
if (email.IndexOf(".", email.IndexOf('@') + 1) == -1)
{
return false; // brak kropki po małpie
}
else return true;
}
示例5: PutFile
public void PutFile(String userid, String sessionid, String filename, String logData, bool overwrite)
{
//Debug.Log("Incoming.SendString(" + filename + ") : logData size = " + logData.Count());
SetUserSessionID(userid, sessionid);
if (networkView != null && Network.peerType != NetworkPeerType.Disconnected)
{
int count = logData.Count();
int index = 0;
// send start command
networkView.RPC("ReceiveBlockStart", RPCMode.Server, localPlayer.player, filename, overwrite);
// do middle blocks
while (count > 0)
{
int blocksize = Math.Min(count, MAX_BLOCKSIZE);
string data = logData.Substring(index, blocksize);
//Debug.Log("Incoming.SendString() : send block size = " + blocksize);
networkView.RPC("ReceiveBlock", RPCMode.Server, localPlayer.player, filename, data);
index += blocksize;
count -= blocksize;
//Debug.Log("Incoming.SendString() : ReceiveBlock done");
}
// send end command
networkView.RPC("ReceiveBlockEnd", RPCMode.Server, localPlayer.player, filename);
}
}
示例6: ReceiveBlock
void ReceiveBlock(NetworkPlayer player, String logName, String logData)
{
Debug.Log("ReceiveBlock: " + logName + " : total=" + logData.Count());
LogMgr logMgr = LogMgr.GetInstance();
if (logMgr != null)
{
foreach (PlayerInfo info in playerInfo)
{
if (info.player == player)
{
// Add to struct
info.BlockAdd(logName, logData);
}
}
}
}
示例7: blockSqlInjection
/// <summary>
/// Examines a fully qualified SQL object and the columns to be included in the operation for key words utilized in SQL injection attacks.
/// </summary>
/// <param name="objName">The fully qualified name of the database object on which the query is to be executed as a parsed array of strings. (i.e. database.schema.table) </param>
/// <param name="cols">String: a concatenated string of columns to be examined for illegal values known to be used in SQL injection attacks.</param>
/// <returns>String - A JSON-formatted result containing details of any threats discovered from the analysis.</returns>
private static String blockSqlInjection(String[] objName, String cols)
{
String err = String.Empty;
if (objName.Count() < 3)
{
err = "{\"InvalidInputError\":\"A fully qualified view, table, or function name must be supplied.(i.e. database.schema.table\"}";
}
if (cols.Contains("DROP ") | cols.Contains("DELETE ") | cols.Contains("CREATE ") | cols.Contains("ALTER "))
{
err = "{\"InvalidDDLError\":\"Objects may not be created, deleted, or destroyed.\"}";
}
if (objName.Contains("master") | objName.Contains("model") | objName.Contains("msdb") | objName.Contains("tempdb"))
{
err = "{\"InvalidResourceError\":\"System databases may not be referenced within this query.\"}";
}
return err;
}