Update: these will work best as Extension Methods when used with .NET 3.5
public static string Space(int width) { return String.Empty.PadLeft(width); } public static string LeadingZeros(string number, short length) { return number.Length < length ? number.PadLeft(length, '0') : number; } public static string Right(string value, int length) { return value.Length > length ? value.Substring(value.Length - length, length) : value; } public static string Left(string value, int length) { return value.Length > length ? value.Substring(0, length) : value; } public static string StripNonNumeric(string value) { return String.Join("", Regex.Split(value, @"[\D]")); } public static string Strip(string sourceValue, string stripValue) { string[] stripValues = { stripValue }; return String.Join("", sourceValue.Split(stripValues, StringSplitOptions.None)); }
Remember Me
Powered by: newtelligence dasBlog 1.8.5223.2
© Copyright 2008, Troy DeMonbreun
E-mail