I have 2 Truncate string methods.
First:
public static string Truncate(string source, int length)
{
if (source.Length > length)
{
source = source.Substring(0, length);
}
return source;
}
Second:
public static string Truncate2(string source, int length)
{
return source.PadRight(length).Substring(0, length).Trim();
}
Which of these methods is better, faster?