Saturday, July 2, 2011

How to display only characters before new line character in a string.

string ssDescription ='c# programming is really fun. When...';
if (sDescription.Contains("\n") == true)
{
    char[] splitCharsNewLine = { '\n' };
     string[] arrReturnValues = sDescription.Split(splitCharsNewLine);
     sDescription = arrReturnValues[0] + "...";
}

No comments:

Post a Comment

LIveCharts2: Charts for Windows and web

Charts for Windows and web including .Net MAUI  LiveCharts - LiveCharts2 (lvcharts.com)