首次上传
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
#nullable enable
|
||||
namespace Sicentury.Core.Extensions
|
||||
{
|
||||
public static class StringExtension
|
||||
{
|
||||
public static string? Truncate(this string? value, int maxLength, string truncationSuffix = "…")
|
||||
{
|
||||
return value?.Length > maxLength
|
||||
? value.Substring(0, maxLength) + truncationSuffix
|
||||
: value;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user