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

Choosing the right ASP.NET Core approach

Blazor would be great if: You want real-time updates as users input their cards You need rich client-side interactivity without writing J...