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


C# String.Count方法代码示例

本文整理汇总了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;
    }
开发者ID:sidhantster,项目名称:ratemymp11december,代码行数:45,代码来源:SessionCreation.aspx.cs

示例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);
                }
            }
    }
开发者ID:LimeyJohnson,项目名称:RandomProjects,代码行数:53,代码来源:AdvancedSearch.aspx.cs

示例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);
        }
    }
开发者ID:Sonarr,项目名称:CurlSharp,代码行数:23,代码来源:SSLGet.cs

示例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;
 }
开发者ID:sohelnewaz,项目名称:ForeignLanguageSchool,代码行数:13,代码来源:Register.aspx.cs

示例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);
        }
    }
开发者ID:MedStarSiTEL,项目名称:UnityTrauma,代码行数:33,代码来源:Incoming.cs

示例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);
                }
            }
        }
    }
开发者ID:MedStarSiTEL,项目名称:UnityTrauma,代码行数:17,代码来源:Incoming.cs

示例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;
    }
开发者ID:jgcoding,项目名称:J-SQL,代码行数:25,代码来源:SqlToJson.cs


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