18 lines
421 B
C#
18 lines
421 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Utils
|
|
{
|
|
public static class Strings
|
|
{
|
|
public static string Truncate(this string value, int maxLength)
|
|
{
|
|
if (string.IsNullOrEmpty(value)) return value;
|
|
return value.Length <= maxLength ? value : value.Substring(0, maxLength);
|
|
}
|
|
}
|
|
}
|