/// <summary>
/// If lenght of the string is greater than max allowed, remove the end
/// </summary>
/// <param name=”str”></param>
/// <param name=”maxLength”></param>
/// <returns></returns>
public static string TrimLength(string str, int maxLength)
{
if (str.Length > maxLength)
{
str = str.Remove(maxLength);
}
return str;
}
↧
Helper String function to TrimLength
↧