Some Useful Functions

1. convert a string to Proper Case

public static string ConvertToProperCase(string text)
System.Globalization.TextInfo TI = new System.Globalization.CultureInfo("en-US",false).TextInfo;
return TI.ToTitleCase(text);

eg: "rOshaN punnIlaTH mOHAmmed" --> "Roshan Punnilath Mohammed"

2. To validate that a string is a valid date

public static bool IsDate(string text)
return true;
catch { return false; }

3. To remove HTMl tags from a string

public static string RemoveHTML(string desc)
return Regex.Replace(desc,@"<(.\n)*?>", string.Empty);

4. To read a file

public static string ReadFile(string sFile)
StreamReader SR;
string sText;
SR = File.OpenText(sFile);
sText = SR.ReadToEnd();


Popular posts from this blog

മലയാളത്തില്‍ മൊത്തം എത്ര അക്ഷരങ്ങള്‍ ഉണ്ട്?

Convert Number To Words in SQL Sever

Crystal reports load report failed: Could not load file or assembly CrystalDecisions.Web, Version=10.2.3600.0