Free cookie consent management tool by TermsFeed Policy Generator

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

Last change on this file since 5186 was 5186, checked in by wtollsch, 14 years ago

#1198 MVC2 plugin template added for HL OKBWebClient

File size: 673 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.