added truncating function.

This commit is contained in:
DESKTOP-GENO133\IvanPlex
2024-01-09 22:15:53 -07:00
parent 3105622d63
commit d5aee08f69
7 changed files with 21 additions and 6 deletions

View File

@@ -7,5 +7,20 @@
{
public static string DbName = "data/cartracker.db";
public static string UserConfigPath = "config/userConfig.json";
public static string TruncateStrings(string input, int maxLength = 25)
{
if (string.IsNullOrWhiteSpace(input))
{
return string.Empty;
}
if (input.Length > maxLength)
{
return (input.Substring(0, maxLength) + "...");
} else
{
return input;
}
}
}
}