Wednesday, 1 June 2016

How to split the string in asp.net?

   if (!string.IsNullOrWhiteSpace(tempitemnoList))
                    {
                        string[] tempNumber = tempitemnoList.Split(new string[] { "/" }, StringSplitOptions.None);
                        if (tempNumber.Count() > 0)
                        {
                            for (int i = 0; i < tempNumber.Count(); i++)
                            {
                                if (tempNumber[i] != "")
                                {
                                    string[] temp = tempNumber[i].Split(new string[] { "," }, StringSplitOptions.None);
                                    if (temp.Count() > 0)
                                    {
                                        if (temp[0] != "")
                                        {
                                            string VendorItemNo = temp[0];
                                            VendorItem item = new VendorItem();
                                            var data = objdb.GetInvoiceImportPriceById(Convert.ToInt32(temp[0])).FirstOrDefault();
                                            if (data != null)
                                            {
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    return Json(new { success = true }, JsonRequestBehavior.AllowGet);

No comments:

Post a Comment