SUN SUN - 1 year ago 102
ASP.NET (C#) Question

remove value from after space detects

I just want to remove values from string after space


if string value is (Music powerbanks pendrives) then it should replace it with (Music)

string productCategory = "Music PowerBank pendrives";

I just want to get first word from string

Answer Source
int index = productCategory.IndexOf(' ');
if (index != -1)
    productCategory = productCategory.Substring(0, index);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download