Free cookie consent management tool by TermsFeed Policy Generator

source: branches/WebApplication/MVC2/HLWebOKBAdminPlugin/Helpers/HtmlHelpers.cs @ 10743

Last change on this file since 10743 was 6317, checked in by jwolfing, 13 years ago

#1433 code formatted

File size: 589 bytes
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Web;
5using System.Web.Mvc;
6
7namespace HLWebOKBAdminPlugin.Helpers {
8  public static class HtmlHelpers {
9
10    public static string Truncate(this HtmlHelper helper, string input, int length) {
11      //takes a string and adds "..." if length > max length
12
13      if (input == null)
14        return "";
15
16      if (input.Length <= length) {
17        return input;
18      }//if
19      else {
20        return input.Substring(0, length) + "...";
21      }//else
22    }//Truncate
23
24  }//HtmlHelpers
25}
Note: See TracBrowser for help on using the repository browser.