This commit is contained in:
2020-02-27 16:05:02 +00:00
parent 060366e13d
commit 93908d1c35
4 changed files with 33 additions and 6 deletions

View File

@@ -115,6 +115,20 @@ namespace AyaNova.Util
return ret;
}
//Used to ensure a unique name generated by appending -nnn is within length requirements by splitting and chopping part of text to keep name
public static string UniqueNameBuilder(string oldName, long appendValue, int maxLength)
{
var appendString = "-" + appendValue.ToString();
string ret = oldName + appendString;
var diff = maxLength - ret.Length;
if (diff < 0)
{
ret = oldName.Substring(0, Math.Abs(diff)) + appendString;
}
return ret;
}
//used to trim an enum type down to only it's most relevant (rightmost) portion
public static string TrimTypeName(string str)
{