Free cookie consent management tool by TermsFeed Policy Generator

source: branches/WebApplication/MVC2/HLWebOKBQueryPlugin/Helpers/HtmlHelpers.cs @ 12128

Last change on this file since 12128 was 5756, checked in by cfleisch, 14 years ago

Test Query Plugin added #1439

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.