Tuesday, 10 May 2016

C# - ASP.NET - String - get text before and after specified character (space)

Watch this example on YouTube

       string test = "one two";
            string s1 = test.Substring(0, test.IndexOf(" "));
            string s2 = test.Substring(test.IndexOf(" ") + 1);
            Response.Write(s1);
            Response.Write("<br />");
            Response.Write(s2);

No comments:

Post a Comment